|
Last modified 2006/10/16, 1 New, 0 Updated General
Keystrokes Sending
File Variable Manipulation
Windows
Text Processing
Clipboard
Windows Processes Forms and Menus
Internet
Registry
Note: All macro samples are sorted by categories.
|
||||||
|
||||||
|
Sample Id: KEY0001 Description: The macro starts Notepad and when its window is opened on the screen, a text is typed in it (keystrokes are sent). There are two versions of the macro. The first one is more complicated, however, reliable in all circumstances and the second one is really simple, working on most computers but not so bullet proof as the first one. Author: Pitrinec, support@pitrinec.com Commented macro code: <#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds> <#> Start notepad... <execappex>("notepad.exe","","",0,0) <#>... and wait until it is loaded <waitfor>("WIN","OPEN","mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",5,0) <#> Make Notepad window active (so that it can receive keyboard keys)... <actwin>("mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",0,0,"no")
<#> and make sure
the Notepad window is active <#> End of the macro <#> Start of the
macro <#> End of the macro |
||||||
|
||||||
|
Sample Id: WIN0001 Description: Activate Notepad window if Notepad is running or start it if it is not running yet. Author: Pitrinec, support@pitrinec.com Commented macro code: <#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds> <#> Do not automatically display error message, the error will be handled in <#> the macro directly <me_error_nodisplay> <#> Activate Notepad window defined by the window name (Notepad) <actwin>("mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",0,0,"no") <#> Let's check _vErr system variable for an error... <if_str>("_vErr!=NO") <#>The Notepad window probably does not exist yet so we have to start notepad.exe <#> Clear the error detected since it is handled now <me_error_clear> <#> Start notepad.exe <execappex>("Notepad.exe","","",0,0) <endif> <#> Turn on automatic error display <me_error_display> <#> End of the macro
|
||||||
|
||||||
|
Sample Id: KEY0002 Description: This sample adds prefix and postfix text to each line in a selected text file. Open, load, modify and save text. Author: Pitrinec, support@pitrinec.com
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds> <#> Add Form Items-input file <form_item>("f1","Input
file:","EDIT_FILE","*.txt","vInputFile")
<form_item>("f1","Output
file:","EDIT_FILE","%_vFolder_Temp%\output.txt","vOutputFile")
<form_item>("f1","Prefix:","EDIT",">>>","vPrefix")
<form_item>("f1","Postfix:","EDIT","<<<","vPostfix")
<form_show>("f1","Form","shell32.dll",0,,0)
<if_str>("_vCanceled==1")<exitmacro><endif>
<data_load>("vbTemp_FileText","vInputFile","")
<data_save>("","vOutputFile","")
<if_str>("_vErr==NO")
<var_oper>(vbTemp_NumOfLines,"vbTemp_FileText",TEXT_GET_NUMOFLINES,"","",
"0")
<begloop>(vbTemp_NumOfLines)
<varset>("v100=EXPR(%_vLoopCounter%/100)","")
<if_num>("_vLoopCounter == EXPR(100*%v100%)")
<msgoff>
<msg>(32,32,"%_vLoopCounter% lines of
%vbTemp_NumOfLines% processed.","Processing",0)
<endif>
<var_oper>(vbTemp_LineText,"vbTemp_FileText",TEXT_GET_LINE,"_vLoopCounter","",
"0")
<var_oper>(vbTemp_LineText,"%vbTemp_LineText%",STR_INSERT,"0","%vPrefix%",
"0")
<var_oper>(vbTemp_LineText,"%vbTemp_LineText%",STR_APPEND,"%vPostfix%%_vKeyReturn%","",
"0")
<data_save>("vbTemp_LineText","vOutputFile","A")
<endloop>
<msg>(-100,-100,"_vError","File Error",1)
<msg>(-100,-100,"Do you want to open output file
now?","Message",2)
<if_str>("_vMsgButton==YES")
<fileopen>("%vOutputFile%",0)
|
||||||
|
||||||
|
Sample Id: WIN0002 Description: This macro will close all opened Notepad windows. Author: Pitrinec, support@pitrinec.com Commented macro code: <#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is
ignored
<me_error_nodisplay> <label>("CloseNext") <winclose>("mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",0) <if_str>("_vErr==NO")
<goto>("CloseNext")
<me_error_clear> <me_error_display> <#> End of the macro
|
||||||
|
||||||
|
Sample Id: CLI0001
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<var_oper>(vClipboardText,"",GET_TEXT_FROM_CLIPBOARD,"","",
"0")
<if_str>("vClipboardText!=_vStrEmpty")
<var_oper>(vClipboardText,"%vClipboardText%",STR_UPPER,"","",
"0")
<clpput>("vClipboardText")
<msg>(-100,-100,"Clipboard is
empty.","Message",1) <#> End of the macro |
||||||
|
||||||
|
Sample Id: PRO0001
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<if_process>(notepad.exe,EXIST)
<msg>(-100,-100,"Notepad.exe is running. Do you want to kill it?","Message",2)
<if_str>("_vMsgButton==YES")
<process_kill>(notepad.exe)
<msg>(-100,-100,"Notepad.exe is not running.","Message",1) <#> End of the macro |
||||||
|
||||||
|
Sample Id: CLI0002
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<var_oper>(vClipboardText,"",GET_TEXT_FROM_CLIPBOARD,"","", "0")
<if_str>("vClipboardText==_vStrEmpty")
<msg>(-100,-100,"There is NO text in clipboard. ","Message",1)
<clpput>("%vClipboardText%") <#> End of the macro |
||||||
|
||||||
|
Sample Id: TEX0005 Set of text manipulation macros. For convenience and simplicity I
assigned each group to numpad hotkeys. In order to easy assign the
appropriate group to numpad keys the macro
SwitchNumpad is used. It can be activated separately or by mouse
macros TxtChg (with submenus) or
TxtChg-Alternate (only main menu). These
mouse macros can also be used to activate the text-manipulation macros in
group TextManMacros. Above macros are located
in mouse macro group TextManMouse. If in
macro SwitchNumpad no macro is selected (ESC
entered) the assignments to numpad keys are removed.
If you dont want to use numpad keys, there is another group of
macros (MultiClip) to provide for 9 text
strings to save/paste. They simulate the windows standard Ctrl-C, Ctrl-X,
Ctrl-V with Win-C, Win-X, Win-V and afterwards pressing 1-9. 0 again is
used to activate load/save by key.
Macro file to download: TextMan.4tw, valid for Macro ToolsWorks version 7.
|
||||||
|
||||||
|
Sample Id: TEX0001
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<form_item>("f1","Original file name:","EDIT","MyFileName","vOriginalFileName") <form_item>("f1","File extension:","EDIT",".txt","vFileExtension")
<form_show>("f1","File Name","shell32.dll",0,0,0) <if_str>("_vCanceled == 1") <exitmacro> <endif> <#>
Else assign to variable vNewFileName value :
vOriginalFileName-Year-Month-Day.txt
<msg>(-100,-100,"vNewFileName","Message",1) <#> End of the macro |
||||||
|
||||||
|
Sample Id: TEX0002
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<form_item>("f1","Service:","LIST","UNIX Virtual Server|NT Virtual Server|UNIX Dedicated Server|NT Dedicated Server","vService")
<form_item>("f1","Discount (in %):","LIST","0|5|10|20|30|50","vDiscount")
<form_item>("f1","Support staff:","LIST","John McSmith|Adrian Mane|Brigita Largo","vStaff")
<form_show>("f1","Customer Requests Information About Service","shell32.dll",0)
<if_str>("_vCanceled == 1") <exitmacro> <endif>
<waitfor>("WIN","OPEN","mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",5,0)
<actwin>("mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",0,0,"no")
<if_win>("mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ","ACT",0)
<varset>("vPrice=99.95","") <if_str>("vService==NT Virtual Server") <#>
<if_str>("vService==UNIX Dedicated Server")
<varset>("vPrice=299.95","") <if_str>("vService==NT Dedicated Server")
<varset>("vPrice=259.95","") <#> Calculate variable vDiscountedPrice
<var_oper>(vDiscountedPrice,"%vPrice%-(%vPrice%*(%vDiscount%/100))",CALC_EXPRESSION,"2","", "0")
Customer: <varout>("vCustomerName",0)
Service: <varout>("vService",0) <#> End of the macro |
||||||
|
||||||
|
Sample Id: TEX0003
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<varset>("parDateString=-%_vCurrDate_Year%-%_vCurrDate_MM%-%_vCurrDate_DD%","")
<proc_def_end> <#>
Start definition of procedure InsertDateToFileName with parameter parFileName
<proc_call>(GetDateString,"lpvDateString")
<var_oper>(vbLnt,"%parFileName%",STR_LENGTH,"","", "0")
<begloop>(vbLnt) <var_oper>(vbInx,"%vbLnt%-%_vLoopCounter%",CALC_EXPRESSION,"0","", "0") <var_oper>(vbChar,"%parFileName%",STR_GET_CHAR,"vbInx","", "0") <if_str>("vbChar==.") <var_oper>(parFileName,"%parFileName%",STR_INSERT,"vbInx","%lpvDateString%", "0")
<#> Go to label
lbl_b_End
<var_oper>(parFileName,"%parFileName%",STR_APPEND,"%lpvDateString%","", "0")
<label>("lbl_b_End")
<proc_def_end>
<#>
Start of macro
<if_str>("_vCanceled == 1") <exitmacro> <endif>
<proc_call>(InsertDateToFileName,"vFile") <msg>(-100,-100,"vFile","Message",1)\ <#> End of the macro
|
||||||
|
||||||
|
Sample Id: VAR0001
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<waitfor>("WIN","OPEN","mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",5,0)
<actwin>("mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",0,0,"no")
<if_win>("mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ","ACT",0)
<#> Yes, insert time & date here:
<varset>("vDate=<%_vCurrDate_DD%><%_vCurrDate_MM%><%_vCurrDate_Year%>","")
<varout>("vDate",0) <#> End of the macro |
||||||
|
||||||
|
Sample Id: INT0001
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<if_str>("_vIsConnectedToInternet==YES") <msg>(-100,-100,"Computer is connected to internet.","Message",1) <msg>(-100,-100,"Computer is NOT connected to internet.","Message",1) <#> End of the macro |
||||||
|
||||||
|
Sample Id: FIL0001
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<if_str>("_vCanceled==1")<exitmacro><endif>
<msg>(-100,-100,"No files found in selected directory.","Message",1)
<exitmacro>
<#>
Write each file name to new line in Notepad
<#> End of the macro
|
||||||
|
||||||
|
Sample Id: FOR0001
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<form_item>("f1","Example: 1+(3/2-3.212)^2","TEXT","","") <#>
Program label "Show"
<#>
Show form with input field
<if_str>("_vCanceled == 1") <exitmacro> <endif> <#>
Calculate entered expression
<msg>(-100,-100,"vResult","Result:",1) <#>
Go to program label "Show"
<#> End of the macro |
||||||
|
||||||
|
Sample Id: VAR0002
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<if_str>("_vCanceled==1")<exitmacro><endif>
<#> File Name: <#> End of the macro |
||||||
|
||||||
|
Sample Id: TEX0004
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds> <#>
Show input form for variable vInputFile
<if_str>("_vCanceled==1")<exitmacro><endif> <#> Close message window
<msgoff> <#>
Store 0 to variable vNumOfEmailAddresses
<data_load>("vbTemp_FileText","vbFilePath_Input","")
<if_str>("_vErr==NO")
<#> Count number of words in text
<begloop>(vNumOfWords)
<#> Get one word
<if_str>("vWord ~= @") <#> <#> Compare, if in word is letter "."
<if_str>("vWord ~=.")
<msg>(-100,-100,"INSTEAD OF THIS MESSAGE, YOU CAN DO YOUR OWN E-MAIL ADDRESS PROCESSING HERE. <msg>(-100,-100,"_vError","File Error",1) <msg>(-100,-100,"No e-mail address found in the file.","File Error",1) <#> End of the macro
|
||||||
|
||||||
|
Sample Id: GEN0001
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <run_ctxcommand>("c:\",Properties,0,0)<wx>(5000) <#> End of the macro
|
||||||
|
||||||
|
Sample Id: FIL0003
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<var_oper>(vFile,"",SELECT_FILE,"","", "0")
<if_str>("_vCanceled==1")<exitmacro><endif> <execappex>("notepad.exe","vFile","",0,0) <#> End of the macro |
||||||
|
||||||
|
Sample Id: FOR0002
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<menu_additem>("vWindow[_vLoopCounter0]") <if_str>("vWindowSelected!=NO") |
||||||
|
||||||
|
Sample Id:
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds> <#>
Read registry keys in to array vKey[]
<msg>(-100,-100,"No keys found under HKEY_CURRENT_USER\Software.","Message",1) <#> Exit macro <exitmacro>
<waitfor>("WIN","OPEN","mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",5,0)
<actwin>("mw[[ ]] mc[[ Notepad ]] cw[[ ]] cc[[ ]] ",0,0,"no") <#>
If Notepad window is active - on top
<varout>("vKey[_vLoopCounter0]",0)
<newline> <#> End of the macro
|
||||||
|
||||||
|
Sample Id: FOR0003
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<msg>(100,100,"What color do you like?","Message",0)
<msgoff> <#>
Show message with selected menu item
<#> End of the macro
|
||||||
|
||||||
|
Sample Id: FOR0004
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<form_item>("f1","Your name:","EDIT","","vName")
<form_item>("f1","I like it!","CHECK","YES","vLikeIt")
<form_item>("f1","This is just a sample.","TEXT","","") <#>
Show form with defined controls
<if_str>("_vCanceled == 1") <exitmacro> <endif> <#>
Show entered variables
<#> End of the macro |
||||||
|
||||||
|
Sample Id: INT0002
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<varset>("vLocalFile=%_vFolder_Temp%hello.txt","")
<ftp_getfile>("vLocalFile","ftp://pitrinec.com/pub/hello.txt","anonymous","")
<if_str>("_vErr==NO") <msg>(-100,-100,"The file was downloaded OK. It will be shown now.","Message",1) <execappex>("notepad.exe","vLocalFile","",0,0) <#> End of the macro |
||||||
|
||||||
|
Sample Id: KEY0003
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds>
<execappex>("notepad.exe","","",0,0) <#> End of the macro |
||||||
|
||||||
|
Sample Id: CLI0003
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds> <#>
Assign only text from clipboard to variable vClipboardText
<if_str>("vClipboardText==_vStrEmpty") <msg>(-100,-100,"There is NO text in clipboard. ","Message",1) <msg>(-100,-100,"There is this text in clipboard: <#> End of the macro |
||||||
|
||||||
Sample Id: FOR0005
Commented macro code:
<#> Start of the macro
<#> Sample macro for Microsoft Internet Explorer: |
||||||
|
||||||
Sample Id: FIL0002
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds> <#>
Show input form for variable vInputFile
<if_str>("_vCanceled==1")<exitmacro><endif>
<data_load>("vbTemp_FileText","%vFile%","")
<if_str>("_vErr==NO")
<var_oper>(vbTemp_NumOfLines,"vbTemp_FileText",TEXT_GET_NUMOFLINES,"","", "0") <begloop>(vbTemp_NumOfLines)
<var_oper>(vbLine,"vbTemp_FileText",TEXT_GET_LINE,"_vLoopCounter","", "0")
<msg>(-100,-100,"INSTEAD OF THIS MESSAGE, YOU CAN DO YOUR OWN FILE LINE PROCESSING.
Line number:
<#> Current
line content
<endloop> <msg>(100,100,"_vError","Error",1) <#> End of the macro | ||||||
|
||||||
|
Sample Id: cli0004 I use this with Perfect Keyboard 6.24, Windows XP Home, a Palm Zire 71 and a cheap USB infrared adaptor.
Author: Mark Major www.markmajor.com
Commented macro code:
<#> Start of the macro <#> Only commands takes effect in the macro, new lines and other text is ignored <cmds> <#>Clipboard2infrared by Mark Major www.markmajor.com <#>Save text from clipboard to temporary text file <data_save>("_vClpText","%_vFolder_Temp%\fromPCclipboard.txt","") <#>Transfer file by infrared ftp <execappex>("C:\WINDOWS\system32\irftp.exe","%_vFolder_Temp%\fromPCclipboard.txt /h","",0,0) <#> End of the macro
|
||||||
|
||||||
|
Sample Id: cli0005
Author: Mike Godin
Commented macro code:
<#> Start of the macro
<#>Transfer
clipboard contents across network.
|
||||||
|
||||||
|
Sample Id: win0003
Author: Robert Gabler
Commented macro code:
<#> Start of the macro <cmds>
<#>only nesessary if not in before code
| ||||||
|
||||||
|
Sample Id: win0004
Author: Robert Gabler
Commented macro code:
<#> Start of the macro
<cmds>
<varout>("n",0) # terminate with no save
<#>===================================================================/
| ||||||