Docfxit Posted Sunday at 07:02 AM Share Posted Sunday at 07:02 AM This code is moving the mouse to a different application. I would like it to stay on the same window and just move the mouse. How can I get it to stay on the Firefox window? expandcollapse popupOpt("WinTitleMatchMode", 2) Global $Paused HotKeySet('{ESC}', '_Terminate') HotKeySet("{end}", "_TogglePause") While 1 $firefoxWindow = WinWaitActive("[CLASS:MozillaWindowClass]", "", 10) ; Check if the Firefox window was found and activated If $firefoxWindow Then Local $loopCount = 0 Local $maxLoops = 4 While $loopCount < $maxLoops $OriginalX = MouseGetPos(0) $OriginalY = MouseGetPos(1) $MoveX = 5 $MoveY = 0 MouseMove($OriginalX + $MoveX, $OriginalY + $MoveY, 5) MouseClick("left", MouseGetPos(0), MouseGetPos(1)) Sleep(400) MouseMove($OriginalX - $MoveX, $OriginalY - $MoveY, 5) MouseClick("left", MouseGetPos(0), MouseGetPos(1)) $loopCount = $loopCount + 1 Sleep(400) WEnd EndIf WEnd Func _TogglePause() $Paused = Not $Paused While $Paused Sleep(100) ToolTip('Script is "Paused = SCRIPT IS NOT RUNNING"', 0, 0) WEnd ToolTip("") EndFunc ;==>TogglePause Func _Terminate() Exit EndFunc ;==>_Terminate Link to comment Share on other sites More sharing options...
FadeSoft Posted Wednesday at 03:53 AM Share Posted Wednesday at 03:53 AM If... Winactive() Then... you could also use blockinput until the code has completely finished BlockInput(1) Code BlockInput(0) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now