Jump to content

Need help with 2 little things


Recommended Posts

I need to loop my macro endlessly and have a hotkey setup so that I can stop the macro at any time. I'd like to type while the macro is running so i'd prefer the stop key to be a key that isn't used in typing. If anyone can add those few simple lines of code to the following script that would be very helpful.

For $x = 1 To 14
    
    MouseClick("Left", 880, 414)
    
    
    MouseClick("Left", 967, 520)
    

Next

Sleep(1000)

MouseClick("Right", 508, 200)
    Sleep(300)

MouseClick("Left", 517, 237)
    Sleep(1000)

MouseClick("Right", 643, 289)
    Sleep(300)

MouseClick("Left", 633, 356)
    Sleep(300)

MouseClick("Right", 882, 337)
    Sleep(300)

MouseClick("Left", 882, 413)
    Sleep(300)

MouseClick("Right", 686, 284)
    Sleep(300)

MouseClick("Left", 674, 358)
    Sleep(300)

MouseClick("Left", 739, 122)
    Sleep(400)
Link to comment
Share on other sites

; Press Esc to terminate script, Pause/Break to "pause"

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


While 1
    Sleep(100)
WEnd
;;;;;;;;

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

Func ShowMe()
    $Runner = Not $Runner
    
    While $Runner
        For $x = 1 To 14

            MouseClick("Left", 880, 414)


            MouseClick("Left", 967, 520)


        Next

        Sleep(1000)

        MouseClick("Right", 508, 200)
        Sleep(300)

        MouseClick("Left", 517, 237)
        Sleep(1000)

        MouseClick("Right", 643, 289)
        Sleep(300)

        MouseClick("Left", 633, 356)
        Sleep(300)

        MouseClick("Right", 882, 337)
        Sleep(300)

        MouseClick("Left", 882, 413)
        Sleep(300)

        MouseClick("Right", 686, 284)
        Sleep(300)

        MouseClick("Left", 674, 358)
        Sleep(300)

        MouseClick("Left", 739, 122)
        Sleep(400)
    WEnd
EndFunc   ;==>ShowMe

8)

NEWHeader1.png

Link to comment
Share on other sites

thx but it doesn't seem to work. I'm not familiar enought to figure out why. I ran script and compiled and ran it as an exe file, but it didn't work. However, after running it when i hit "pause" it said "script paused" in the upper left corner of my screen so something is running, it's just not clicking.

Link to comment
Share on other sites

@Peter960

How do you expect the pause part of your script to work?

Your writing a script. So when people provide some code to you you have to study it to understand how it works. When you understand that you will be able to configure it to your likings.

When you hit pause the code goes into a loop until you hit pause again.

Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause
Link to comment
Share on other sites

How do you expect the pause part of your script to work?

Your writing a script. So when people provide some code to you you have to study it to understand how it works. When you understand that you will be able to configure it to your likings.

When you hit pause the code goes into a loop until you hit pause again.

Ya I get that, but the rest of the script didn't seem to work. I was on my way to bed last night and didn't look too closely at it but now I see I needed to hit "F9" to start the clicking.

Thanks Val, works great.

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...