На форуме нашел PureAutoIt. http://www.purebasic.fr/english/viewtopic.php?f=14&t=66067
Несколько примеров из архива.
Несколько примеров из архива.
ControlClick.pb
ControlSend.pb
PixelSearch.pb
TimerDiff.pb
Код:
XIncludeFile "..\..\PureAutoIt.pbi"
UseModule PureAutoIt
Procedure Example()
; Run Notepad
Run("notepad.exe")
; Wait 10 seconds for the Notepad window to appear.
hWnd.s = Str(WinWait("[CLASS:Notepad]", "", 10))
; Send a mouse click to the edit control of Notepad using the handle returned by WinWait.
ControlClick(hWnd, "", "Edit1")
; Wait for 2 seconds.
Sleep(2000)
; Close the Notepad window using the handle returned by WinWait.
WinClose(hWnd)
EndProcedure
Example()
ControlSend.pb
Код:
XIncludeFile "..\..\PureAutoIt.pbi"
UseModule PureAutoIt
Procedure Example()
; Run Notepad
Run("notepad.exe")
; Wait 10 seconds for the Notepad window to appear.
hWnd.s = Str(WinWait("[CLASS:Notepad]", "", 10))
; Wait for 2 seconds.
Sleep(2000)
; Send a string of text to the edit control of Notepad. The handle returned by WinWait is used for the "title" parameter of ControlSend.
ControlSend(hWnd, "", "Edit1", "This is some text")
; Wait for 2 seconds.
Sleep(2000)
; Close the Notepad window using the handle returned by WinWait.
WinClose(hWnd)
; Now a screen will pop up and ask to save the changes, the classname of the window is called
; "#32770" and simulating the "TAB" key to move to the second button in which the "ENTER" is simulated to not "save the file"
WinWaitActive("[CLASS:#32770]")
Sleep(500)
Send("{TAB}{ENTER}")
EndProcedure
Example()
PixelSearch.pb
Код:
XIncludeFile "..\..\PureAutoIt.pbi"
UseModule PureAutoIt
; Find a pure red pixel in the range 0,0-20,300
aCoord.s = PixelSearch(0, 0, 20, 300, $FF0000)
If Not _Error()
MsgBox(#MB_SYSTEMMODAL, "", "X and Y are: " + aCoord)
EndIf
; Find a pure red pixel or a red pixel within 10 shades variations of pure red
aCoord.s = PixelSearch(0, 0, 20, 300, $FF0000, 10)
If Not _Error()
MsgBox(#MB_SYSTEMMODAL, "", "X and Y are: " + aCoord)
EndIf
TimerDiff.pb
Код:
XIncludeFile "..\..\PureAutoIt.pbi"
UseModule PureAutoIt
hTimer = TimerInit() ; Begin the timer and store the handle in a variable.
Sleep(3000) ; Sleep for 3 seconds.
iDiff = TimerDiff(hTimer) ; Find the difference in time from the previous call of TimerInit. The variable we stored the TimerInit handlem is passed as the "handle" to TimerDiff.
MsgBox(#MB_SYSTEMMODAL, "Time Difference", Str(iDiff))