Sign in to follow this  
Followers 0
LuLer

Need Help Creating A Script and Editing Another

8 posts in this topic

#1 ·  Posted (edited)

Okay, first of all, I have this script. I googled it and copied it down, I didn't make it myself. What I want it to do is left click very, very fast by itself. This is the script:

HotKeySet("x", "TogglePause")

While 1
$msg = GUIGetMsg(2)
MouseClick("left")
MouseClick("left")
WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('Script is "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc

It clicks fast how I want it to, but the only problem is that when I want to pause it, this error message pops up:

Posted Image

It stops, but when I press "Ok" it just closes. I want it so when my press my hotkey (x) it pauses and not just shuts down after this error.

Secondly, and more importantly, I want to make a custom script. It is pretty basic (I think). All I want it to do is click left click 3 times once I press the hotkey. However, I want to customize how much time there is between the clicks. Can somebody make me a script for 3 left clicks, and teach me how to change the time in between clicks? For the thing that I am doing I have to perfectly time the clicks, so I will be testing the script and changing the intervals a lot.

I am the beginner at AutoIt so please explain things thoroughly. Thanks for any help. :P

Edited by LuLer

Share this post


Link to post
Share on other sites



Hi and welcome to the forum!

You should open your helpfile and take a look at HotKeySet() and you will see what you have done wrong. Like trying to use $Paused without declaring it.

And what's GUIGetMsg(2) supposed to be? The helpfile only mentions 0 and 1 as parameters so that doesn't make any sense (why do you have it in the loop anyway when you don't use/need it?).

For you second question see Sleep() or TimerInit()/TimerDiff().

Share this post


Link to post
Share on other sites

HotKeySet("x", "TogglePause")

$paused=0 ;Starts On

While 1

While $paused=0

$msg = GUIGetMsg(2)

MouseClick("left")

MouseClick("left")

Sleep(50)

WEnd

Sleep(50)

WEnd

Func TogglePause()

If $paused=0 Then

$paused=1

ToolTip('Script is "Paused"',0,0)

Else

ToolTip("")

ToolTip("")

$paused=0

EndIf

EndFunc

Use something like that. A more direct approach.

Share this post


Link to post
Share on other sites

Hi and welcome to the forum!

You should open your helpfile and take a look at HotKeySet() and you will see what you have done wrong. Like trying to use $Paused without declaring it.

And what's GUIGetMsg(2) supposed to be? The helpfile only mentions 0 and 1 as parameters so that doesn't make any sense (why do you have it in the loop anyway when you don't use/need it?).

For you second question see Sleep() or TimerInit()/TimerDiff().

I don't know what GUIGetMsg is. I didn't make this script myself, I googled it and copy/pasted it. I know nothing about the scripting.

Use something like that. A more direct approach.

Thanks, this fixed it for fast clicking mouse, I can now pause!

I need help fixing the same sequence, but for space instead of left click. Here is what I have right now (I get the same error message when I press the hotkey for pause):

HotKeySet("x", "TogglePause")

While 1
$msg = GUIGetMsg(2)
Send("{space}")
Send("{space}")
WEnd

Func TogglePause()
If $paused=0 Then
$paused=1
ToolTip('Script is "Paused"',0,0)
Else
ToolTip("")
ToolTip("")
$paused=0
EndIf
EndFunc

Also if somebody could help me for my second problem:

Secondly, and more importantly, I want to make a custom script. It is pretty basic (I think). All I want it to do is click left click 3 times once I press the hotkey. However, I want to customize how much time there is between the clicks. Can somebody make me a script for 3 left clicks, and teach me how to change the time in between clicks? For the thing that I am doing I have to perfectly time the clicks, so I will be testing the script and changing the intervals a lot.

I am the beginner at AutoIt so please explain things thoroughly. Thanks for any help

Share this post


Link to post
Share on other sites

Help? :P

Share this post


Link to post
Share on other sites

Help? :P

The good Admiral pointed you in the right direction. Lookup Sleep() in the helpfile. It's very easy to use so you shouldn't have any problems with it.


Other People's Stuff:Andy Flesner's AutoIt v3: Your Quick Guide[topic="34302"]Locodarwin's ExcelCom_UDF[/topic][topic="61090"]MrCreatorR's Opera Library[/topic]

Share this post


Link to post
Share on other sites

The good Admiral pointed you in the right direction. Lookup Sleep() in the helpfile. It's very easy to use so you shouldn't have any problems with it.

Yeah, but I am so confused, I have no idea how to make my own script... don't even know what to put on the first line...

Share this post


Link to post
Share on other sites

#include <GUIConstants.au3>
#include <EditConstants.au3>
HotKeySet("x", "Click")
Opt("GUIOnEventMode", 1)
$gui = guicreate("Clicker",95,105)
GUISetState(@SW_SHOW, $gui)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreategroup("Delay 1",5,5,85,40)
$delay1 = GUICtrlCreateInput("",10,20,75,20,$ES_NUMBER)
GUICtrlCreategroup("Delay 2",5,45,85,40)
$delay2 = GUICtrlCreateInput("",10,60,75,20,$ES_NUMBER)
GUIctrlcreatelabel("Hotkey = X",18,87,60,20)

While 1
    sleep(5000)
Wend

Func Click()
MouseClick("left")
sleep(guictrlread($delay1))
MouseClick("left")
sleep(guictrlread($delay2))
MouseClick("left")
EndFunc

Func CLOSEClicked()
    $answer = msgbox(262148, "Close", "Are you sure you wish to close this program?")
    If $answer = 6 Then 
        Exit
    Endif
EndFunc

Share this post


Link to post
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
Sign in to follow this  
Followers 0