Jump to content

How can I get it to stay on the Firefox window?


Docfxit
 Share

Recommended Posts

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?

Opt("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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...