#include #include ;Program script starts here ;Text after the character ';' is a comment notepadExample() ;tutroial example sleep(1000) ;delay for 1000ms or 1sec Send("!{SPACE}") ;Alt+Space Send("^{SPACE}") ;Ctrl+Space Send("+{SPACE}") ;Shift+Space Send("^r") ;Ctrl+'r' Send("abcdefg") ;typing "abcdefg" MouseClick("left",20,20,1,10) ;MouseClick("left"/"right"/"middle"/"main"/"menu"/"primary"/"secondary", ;x, y, number of click, mouse move speed 1-100) MouseClickDrag("left",1,2,100,101,20) ;click and drag from x1=1,y1=2 to x2=100,y2=101 ;open an application program Run("C:\program.exe") ;open a doc together with it's associated program. OpenDoc(".doc", "C:\myFile.doc") ;run program, and specify the working directory that the program need to run under. Program might fail to run properly if it is not run under a specific working directory Run("C:\Fall Detection\Sentry 19R.exe","C:\Fall Detection") Terminate() ;Program script ends here ;More examples as follows ;--------------------------------------------------------- ;Useful Functions ---------------------------------------- ;--------------------------------------------------------- Func notepadExample() Opt("WinWaitDelay", 0) If Not WinExists('[CLASS:Notepad]') Then Run(@WindowsDir & '\Notepad.exe') WinActivate('[CLASS:Notepad]') WinWait('[CLASS:Notepad]') $hRNotepad = WinGetHandle('[CLASS:Notepad]') $iWidth = (@DesktopWidth / 2) - 10 $iHeight = (@DesktopHeight / 2) $y = (@DesktopHeight / 4) WinMove($hRNotepad, "", (@DesktopWidth / 2) + 5, $y, $iWidth, $iHeight) WinSetTitle(WinGetTitle($hRNotepad), "", "Notepad Title") ControlSend("[CLASS:Notepad]",'',15,"your text") EndFunc Func delayExample() Sleep(100) ;delay EndFunc Func keyStrokeExample() ;Keystroke function Send("{ENTER}") Send("{Esc}") Send("{ALT}{SPACE}") ;Alt+Space Send("!{SPACE}") ;Alt+Space Send("^{SPACE}") ;Ctrl+Space Send("+{SPACE}") ;Shift+Space Send("^r") ;Ctrl+'r' Send("^+r") ;Ctrl+'R' Send("abcdefg") ;typing "abcdefg" Send("{ALT}{SPACE}") ;maximuze window (Alt+Space,x) Send("{x}") EndFunc Func mouseExample() MouseClick("left",20,20,1,10) ;MouseClick("left"/"right"/"middle"/"main"/"menu"/"primary"/"secondary", ;x, y, number of click, mouse move speed 1-100) MouseClickDrag("left",1,2,100,101,20) ;click and drag from x1=1,y1=2 to x2=100,y2=101 MouseClick("left") MouseMove(100,200,20) ;mouse move to x=100,y=200, delay_mousespeed=20 $pos = MouseGetPos() MsgBox(0, "Mouse x,y:", $pos[0] & "," & $pos[1]) EndFunc Func executeProgExample() $Program_Location = "C:\program files\winamp\winamp.exe" If FileExists($Program_Location) Then Run($Program_Location)Else MsgBox(64,"Error!!", "The file does not exist" & @CRLF & $Program_Location, 5) EndIf ;Run("C:\DELL\drivers\R132254\setup.exe") ;open an application program Run("C:\program.exe") ;open a doc together with it's associated program. OpenDoc(".doc", "C:\myFile.doc") ;run program, and specify the working directory that the program need to run under. Program might fail to run properly if it is not run under a specific working directory Run("C:\Fall Detection\Sentry 19R.exe","C:\Fall Detection") EndFunc ;example ;msgbox(1,"Title","Text") ;message box example ;WinActivate("title","text") - focus window ;WinClose("title","text") - close window ;WinActive("title","text") - check if window exists ;WinExists("title","text") - check if window exists ;Run(@WindowsDir & '\Notepad.exe') ;WinActivate("Notepad Title") ;WinWait("Notepad Title") ;WinActivate("[CLASS:Notepad]") ;WinWaitActive("[CLASS:Notepad]",'',3) ;--------------------------------------------------------- ;Useful Functions ---------------------------------------- ;--------------------------------------------------------- Func Terminate() Exit 0 ;exit EndFunc Func OpenDoc($extention, $file) ;function to open a document which in turn activate the associated program to run $CodeName = RegRead("HKEY_CLASSES_ROOT\"&$extention, "") $thingtorun = RegRead("HKEY_CLASSES_ROOT\"&$CodeName&"\shell\Open\command", "") $thingtorun = StringReplace($thingtorun, "%1", $file) If Not @extended Then $thingtorun = $thingtorun & " " & $file Run($thingtorun) EndFunc