#cs (C) JA 2020 last mod.: 24/02/2020 start TP-LINK 3G UTILITY click Connect button #ce ;Includes #include #include ;Options Opt("MouseCoordMode", 1) ;Sets the way coords are used in the mouse functions, either absolute coords (1=default) or coords relative to the current active window (0) Opt("WinTitleMatchMode", 2) ; 2 = Match any substring in the title ; Set the Escape hotkey to terminate the script. HotKeySet("{ESC}", "_Terminate") MsgBox($MB_ICONINFORMATION, "(C) JA '2020", "Hello World!", 2) MsgBox($MB_ICONINFORMATION, "", "Open 3G.", 3) While ProcessExists("3GUtility.exe") = 0 Local $aPos = MouseGetPos() While (($aPos[0] < 190) OR ($aPos[0] > 200)) MouseMove(190, 30, 25) Local $aPos = MouseGetPos() MsgBox($MB_SYSTEMMODAL, "Mouse x, y:", $aPos[0] & ", " & $aPos[1], 2) ;Sleep(11000) WEnd MsgBox($MB_ICONINFORMATION, "", "Mouse position reached, click desktop icon...", 2) Sleep(333) MouseClick("left") Sleep(1100) Send("{ENTER}") Sleep(3300) WEnd ; HERE I WANT TO MAKE SURE WINDOW IS IN FRONT OF ALL OTHER ;ProcessWait("3GUtility.exe", 0) MsgBox($MB_ICONINFORMATION, "", "3G running.", 3) Sleep(1100) MsgBox($MB_ICONINFORMATION, "", "Click Connect button...", 3) Sleep(1100) ;MouseMove(1095, 580, 5) ;sometimes not working Local $aPos = MouseGetPos() While (($aPos[0] < 1085) OR ($aPos[0] > 2005)) MouseMove(1095, 585, 25) ;sometimes not working Local $aPos = MouseGetPos() MsgBox($MB_SYSTEMMODAL, "Mouse x, y:", $aPos[0] & ", " & $aPos[1], 2) ;Sleep(11000) WEnd MsgBox($MB_ICONINFORMATION, "", "Mouse position reached, click connect...", 3) Sleep(1100) MouseClick("left") Sleep(1100) ;pause for x milliseconds MsgBox($MB_ICONINFORMATION, "", "End script", 2) Exit Func _Terminate() Exit EndFunc ;==>_Terminate