AutoHotkey Community

It is currently May 26th, 2012, 3:01 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 11 posts ] 
Author Message
 Post subject: Start/Stop correctly
PostPosted: February 2nd, 2009, 10:00 pm 
Hello

I made this script, basically i want it to start when i press ctrl alt x and stop when i press ctrl alt y. Now when it stops it needs to go back to the beginning, and start the process again.

Here is what i have.


Code:
; ctrl-alt-x key starts clicking loop
^!x::
StopIt := 0
Loop
{
IfEqual, StopIt, 1, break
Send, R
sleep, 3000
Send, 1
Sleep, 3000
Click
Sleep, 11000
Click
Sleep, 11000
Click
Sleep, 11000
Click
Sleep, 11000
Click
Sleep, 11000
Click
Sleep, 11000
Click
Sleep, 11000
}
return

; ctrl-alt-y key breaks it
^!y::
StopIt := 1
return


At the moment it wont stop until its finished going down the list back to the top but if i wanted to stop it say after the 3rd click then when the button is pressed to start it goes to Send, R. do you know what i mean?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 10:10 pm 
Code:
^!x::
settimer, aa
return

^!y::
settimer, aa, off
return

aa:
do this
and that
return


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2009, 10:16 pm 
it didnt seem to work, the button was still being clicked after i ctrl alt y.

here is the full script incase im missing anything

Code:
; ctrl-alt-x key starts it and ctrl-alt-y stops it

^!x::
settimer, aa
return

^!y::
settimer, aa, off
return

aa:
Send, R
sleep, 3000
Send, 1
Sleep, 3000
MouseClick, left,  663,  705
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Click
Sleep, 4000
Send, r
Sleep, 3000
send, 0
Click
Sleep, 180000
send, w
Sleep, 3000
MouseClick, left,  663,  705
return

; Note: From now on whenever you run AutoHotkey directly, this script
; will be loaded.  So feel free to customize it to suit your needs.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 10:50 am 
Offline

Joined: December 8th, 2006, 5:17 am
Posts: 248
Location: Sydney Australia
Put your Click /sleep 4000 into a loop. this is a little shorter.
Code:
 ctrl-alt-x key starts it and ctrl-alt-y stops it

^!x::
settimer, aa
return

^!y::
settimer, aa, off
return

aa:
Send, R
sleep, 3000
Send, 1
Sleep, 3000
MouseClick, left,  663,  705
loop 40
{
   Click
   Sleep, 4000
}
Send, r
Sleep, 3000
send, 0
Click
Sleep, 180000
send, w
Sleep, 3000
MouseClick, left,  663,  705
return

; Note: From now on whenever you run AutoHotkey directly, this script
; will be loaded.  So feel free to customize it to suit your needs.

_________________
Paul O


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 12:19 pm 
This script does not stop. It just.keeps.going.
For the sake of my mental state can somebody else test it and confirm it will not stop running with ctrl alt y or any other letter.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 2:11 pm 
Offline

Joined: July 27th, 2008, 7:31 am
Posts: 47
Location: England
Code:
;ctrl-alt-x key starts it and ctrl-alt-y stops it

^!x::
GoSub Start
Return,

^!y::
GoSub Start
Return,

Start:
Send, R
sleep, 3000
Send, 1
Sleep, 3000
MouseClick, left,  663,  705
loop 40
{
   Click
   Sleep, 4000
}
Send, r
Sleep, 3000
send, 0
Click
Sleep, 180000
send, w
Sleep, 3000
MouseClick, left,  663,  705
return

; Note: From now on whenever you run AutoHotkey directly, this script
; will be loaded.  So feel free to customize it to suit your needs.


Unfortunatly I'm at school right now and can't test it... Tell me if it works!

_________________
All scripts are untested unless otherwise mentioned.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 2:14 pm 
Offline

Joined: July 27th, 2008, 7:31 am
Posts: 47
Location: England
If you want ^!y to pause it and not restart it then try this:

Code:
;ctrl-alt-x key starts it and ctrl-alt-y pauses it

^!x::
GoSub Start
Return,

^!y::
Pause
Return,

Start:
Send, R
sleep, 3000
Send, 1
Sleep, 3000
MouseClick, left,  663,  705
loop 40
{
   Click
   Sleep, 4000
}
Send, r
Sleep, 3000
send, 0
Click
Sleep, 180000
send, w
Sleep, 3000
MouseClick, left,  663,  705
return

; Note: From now on whenever you run AutoHotkey directly, this script
; will be loaded.  So feel free to customize it to suit your needs.


Press ^!y to unpause it again.

_________________
All scripts are untested unless otherwise mentioned.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 2:18 pm 
that pause is definitely usefull. But i still need to bind keystrokes to stop the script and return to the beginning . i was looking at the website and i was thinking the Goto command. would this be used to go back to the start which is the Send, R command.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 2:22 pm 
and that other script didnt work, it just kept clicking.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 3:43 pm 
anyone have any ideas?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 3rd, 2009, 4:11 pm 
hurray i did it
for future reference to anyone i used the exit command if break is 1 during the loop. pressing the x key started from the beginning


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: G. Sperotto, patgenn123, Tilter_of_Windmills and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group