Jump to content

Recommended Posts

Posted

Hello, I found this script online and I managed to make it suite my needs. I'm still very new but willing to learn - I hate that I'm having to ask but my searches bring up information that's a bit hard to digest currently.

 

I'm wondering what's the best way to go about reading how many loops are left?

 

Here is what I have (basic script to click a button X amount of times:

Global $Paused, $Runner
HotKeySet("{F9}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

Func MsClick($tittle, $text, $controlid, $clickType, $clicks = 1, $x = 1, $y = 1)
    $coord = UiRatio($x, $y)
    If IsArray($coord) Then
        ControlClick($tittle, $text, $controlid, $clickType, $clicks, $coord[0], $coord[1])
    Else
        MsgBox(1, "Error", "UIRatio() didn't return an Array")
    EndIf
EndFunc   ;==>MsClick

Func UiRatio($_x, $_y)
    Dim $return[2]
    $size = WinGetClientSize("Course Player — Mozilla Firefox") ; Must set so we can get windows' size
    If @error Then ; If @error >= 1 then return
        Return
    Else
        $return[0] = $size[0] * ($_x / $size[0])
        $return[1] = $size[1] * ($_y / $size[1])
    EndIf
    Return $return
EndFunc   ;==>UiRatio

For $i = 1 To InputBox("", "How many times to click?", 1)
    Sleep(100)
    Opt("MouseCoordMode", 2)
    MsClick("Course Player — Mozilla Firefox", "", "", "left", 1, 2481, 133)
    Sleep(25000)
Next

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
    
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

 

Posted (edited)
Global $Paused, $Runner
HotKeySet("{F9}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

Opt("MouseCoordMode", 2) ;1=absolute, 0=relative, 2=client

Global $iClickCnt = InputBox("", "How many times to click?", 1)
Global $hWnd = WinActivate("Course Player — Mozilla Firefox")

For $i = 1 To $iClickCnt
    MsClick($hWnd, "", "", "left", 1, 2481, 133)
    TrayTip("Click count: " & $i, $iClickCnt - $i & " more clicks to go", 5)
    Sleep(25000)
Next

Func MsClick($tittle, $text, $controlid, $clickType, $clicks = 1, $x = 1, $y = 1)
    $coord = UiRatio($x, $y)
    If @error Then
        MsgBox(4096, "Error", "UIRatio() didn't return an Array")
        Exit
    EndIf
    ControlClick($tittle, $text, $controlid, $clickType, $clicks, $coord[0], $coord[1])
EndFunc   ;==>MsClick

Func UiRatio($_x, $_y)
    $size = WinGetClientSize($hWnd) ; Must set so we can get windows' size
    If @error Then ; If @error >= 1 then return @error
        Return SetError(1, 0, "")
    Else
        Local $return[2]
        $return[0] = $size[0] * ($_x / $size[0])
        $return[1] = $size[1] * ($_y / $size[1])
        Return $return
    EndIf
EndFunc   ;==>UiRatio

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

 

Edited by ioa747

I know that I know nothing

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
  • Recently Browsing   0 members

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