AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Start/Stop correctly

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Cyn
Guest





PostPosted: Mon Feb 02, 2009 9:00 pm    Post subject: Start/Stop correctly Reply with quote

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?
Back to top
evan
Guest





PostPosted: Mon Feb 02, 2009 9:10 pm    Post subject: Reply with quote

Code:
^!x::
settimer, aa
return

^!y::
settimer, aa, off
return

aa:
do this
and that
return
Back to top
cyn
Guest





PostPosted: Mon Feb 02, 2009 9:16 pm    Post subject: Reply with quote

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.
Back to top
poo_noo



Joined: 08 Dec 2006
Posts: 248
Location: Sydney Australia

PostPosted: Tue Feb 03, 2009 9:50 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Guest






PostPosted: Tue Feb 03, 2009 11:19 am    Post subject: Reply with quote

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.
Back to top
Robbo



Joined: 27 Jul 2008
Posts: 47
Location: England

PostPosted: Tue Feb 03, 2009 1:11 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Robbo



Joined: 27 Jul 2008
Posts: 47
Location: England

PostPosted: Tue Feb 03, 2009 1:14 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message Send e-mail MSN Messenger
cyn
Guest





PostPosted: Tue Feb 03, 2009 1:18 pm    Post subject: Reply with quote

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.
Back to top
Guest






PostPosted: Tue Feb 03, 2009 1:22 pm    Post subject: Reply with quote

and that other script didnt work, it just kept clicking.
Back to top
cyn
Guest





PostPosted: Tue Feb 03, 2009 2:43 pm    Post subject: Reply with quote

anyone have any ideas?
Back to top
Guest






PostPosted: Tue Feb 03, 2009 3:11 pm    Post subject: Reply with quote

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
Back to top
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group