Skip to content

Instantly share code, notes, and snippets.

@tuantmb
Last active March 30, 2019 02:18
Show Gist options
  • Save tuantmb/4a5a757c99b06681142ca63155c3d10b to your computer and use it in GitHub Desktop.
Save tuantmb/4a5a757c99b06681142ca63155c3d10b to your computer and use it in GitHub Desktop.
Demo auto click using autoit code
; Best Practice:
;
; - Start new applition every session you want to do your task
; (because this application uses multi tabs, choose wrong tab then click with absolute coordinates ==> you fail)
; Finish session => close application to release resource
; - Fix position of your application before doing anything
; - Use Sleep(500) to debug (view step by step every code)
; - Run autoit application with UAC(Administrator) ìf needs (because ISD-VPE2100 required UAC(Administrator),
; so to avoid permission problems, run your autoit application with the same permission with ISD-VPE2100)
#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
Local $hWnd = WinWait("ISD-VPE2100 authorized to TULA Vietnam", "", 10)
If $hWnd = 0 Then
MsgBox($MB_APPLMODAL, "Error", "Not found ISD-VPE2100! Start it first then run this application (Administrator)")
Else
; Active Windows to view activity step by step
WinActivate($hWnd)
; Fix a position
WinMove($hWnd, "", 0, 0)
; click on [Device] tab
MouseMove(81, 68, 10)
Sleep(2000)
MouseClick($MOUSE_CLICK_LEFT)
;MouseClick($MOUSE_CLICK_LEFT)
; move to next tab ==> [Voice Prompt] tab
Sleep(500)
Send("{RIGHT}")
; move to next tab ==> [Voice Macro] tab
Sleep(500)
Send("{RIGHT}")
;
; Because >>>> Mouse <<<< in AutoIt v3 Windows Info is absolute screen coordinates
; so I set MouseCoordMode is 1
; then moving mouse to the position I want by using Mouse Position [Windows Info] Value
;AutoItSetOption("MouseCoordMode", 1)
;
; click to choose register
MouseMove(458, 147)
MouseClick("")
Sleep(3000)
$aPos = MouseGetPos()
MsgBox($MB_SYSTEMMODAL, "Mouse x, y:", $aPos[0] & ", " & $aPos[1])
EndIf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment