| View previous topic :: View next topic |
| Author |
Message |
Maiyr Guest
|
Posted: Sun Nov 22, 2009 12:22 am Post subject: Loop |
|
|
First off I appologize. I really do not understand the script or how to put it together.
Is there a way to loop a button press like, 1, where it pushes once every 30secs and then have it stop and push, 2 and wait a minute before resuming 1? |
|
| Back to top |
|
 |
Maiyr Guest
|
Posted: Sun Nov 22, 2009 12:24 am Post subject: |
|
|
Well to be a little bit more specific...
1 every 30 secs
After two or three minutes 2 and then wait a minute before resuming 1. |
|
| Back to top |
|
 |
rtcvb32
Joined: 17 Feb 2008 Posts: 289
|
|
| Back to top |
|
 |
Maiyr Guest
|
Posted: Sun Nov 22, 2009 1:07 pm Post subject: |
|
|
I do not really understand the documentation. I understand how to change the number for sleep and to change it to a different time but do not understand how to put stuff together.
Right now I am using a old script that I found for World of Warcraft where it simulates a button press, it is not a loop or anything but it pretty much makes it where is have to use a folded piece of paper to hold down the 1 key. |
|
| Back to top |
|
 |
Maiyr Guest
|
Posted: Sun Nov 22, 2009 1:12 pm Post subject: |
|
|
Where is the documentation that helps you be able to read the documentation you posted? With no knowledge of script the terms are unfamiliar to me and it is almost like trying to assemble something using spanish instructions.
Potentially if there is a way I can learn how to read it then I will be able to put scripts together. |
|
| Back to top |
|
 |
i3egohan
Joined: 18 Jul 2006 Posts: 403
|
Posted: Sun Nov 22, 2009 1:42 pm Post subject: |
|
|
| Maiyr wrote: | Where is the documentation that helps you be able to read the documentation you posted? With no knowledge of script the terms are unfamiliar to me and it is almost like trying to assemble something using spanish instructions.
Potentially if there is a way I can learn how to read it then I will be able to put scripts together. |
Haha!! So a syntax documentation isnt enough? You want another doc to read this one? Seriously you are kidding right?
Really wouldnt say stuff like that around here, We cant help people who cannot help themselves.
Open the documentation and read everything in there. EVERYTHING. Look at the code examples ect. Its very easy stufff. |
|
| Back to top |
|
 |
wooly_sammoth
Joined: 12 May 2009 Posts: 634 Location: Gloucester UK
|
Posted: Sun Nov 22, 2009 3:51 pm Post subject: |
|
|
It can seem like a foreign language to begin with and I found the learning curve to be quite steep when I started but it is worth the effort.
The best way to start is as i3egohan said: Try out the examples at the bottom of each doc page by putting just that code in a script and running it so that you can see what effect it has. The re-read the doc page and see if you can combine what it says with what you see when you run the code.
If you do get stuck with anything the forum is here but we need more specific questions to answer.
Have Fun  |
|
| Back to top |
|
 |
Maiyr Guest
|
Posted: Sun Nov 22, 2009 4:08 pm Post subject: |
|
|
How would you make it where,
| Code: | loop, {
Send ; 1
Sleep 30000 ;
}
|
Stops doing 1 every 30 secs after lets say 3 minutes and does 2 once and waits a minute before resuming 1?
I think it would be like...
Start - 1 (Wait 30 sec)
30 sec - 1 (Wait 30 sec)
1 min - 1 (Wait 30 sec)
1.5 min - 1 (Wait 30 sec)
2 min - 1 (Wait 30 sec)
2.5 min - 1 (Wait 30 sec)
3 min - 2 (Wait 1 minute)
[/code] |
|
| Back to top |
|
 |
wooly_sammoth
Joined: 12 May 2009 Posts: 634 Location: Gloucester UK
|
Posted: Sun Nov 22, 2009 4:27 pm Post subject: |
|
|
At it's simplest you can just put sends and sleeps into the loop like so:
| Code: |
Loop
{
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 2
Sleep, 60000
}
|
This will do what you are asking but feels clunky and un-elegant. There are other ways which will do what you want but use a lot less code.
Have a play around with this first and see if you get the result you're after. If you feel up to something a bit more complicated just report back here.
If you do I would recommend reading the documentation for Loop as there are a couple of things in there which the docs explain a lot better than I can |
|
| Back to top |
|
 |
Maiyr Guest
|
Posted: Sun Nov 22, 2009 4:33 pm Post subject: |
|
|
| That made it a lot less complicated then what I thought it was going to be. I will play around with this and I shall be back. Was seeing that there is a way to activate the loop and turn it off as well. Will see if I can figure out to get that to work. |
|
| Back to top |
|
 |
Guest
|
Posted: Sun Nov 22, 2009 11:24 pm Post subject: |
|
|
Ok going to attempt to add a start up, F1, and a end F2, to the Loop
| Code: |
F1::
Loop
{
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 2
Sleep, 60000
F2::break
}
|
|
|
| Back to top |
|
 |
wooly_sammoth
Joined: 12 May 2009 Posts: 634 Location: Gloucester UK
|
|
| Back to top |
|
 |
Maiyr Guest
|
Posted: Mon Nov 23, 2009 1:12 am Post subject: |
|
|
I saw pause and was thinking that when resumed it would start back where it paused at.
How I have it going now. Would F1 Start the Loop and F2 Stop the Loop and if I were to push F1 would it start anew?
Or does pause(resume) start the script from the beginning after it resumes? |
|
| Back to top |
|
 |
entropic
Joined: 21 Dec 2008 Posts: 181
|
Posted: Mon Nov 23, 2009 2:43 am Post subject: |
|
|
Could you post the code you are using?
Autohotkey executes by moving through the file with code from the top down, jumping to functions or labels when they are called and then returning to where they are called from. The Pause command just pauses execution wherever it is at, when the script is un-paused it resumes executing from where it stopped.
The easiest way to exit the loop at any time would be something like this:
| Code: |
F2::Reload
F1::
Loop
{
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 1
Sleep, 30000
Send, 2
Sleep, 60000
}
|
|
|
| Back to top |
|
 |
maiyr Guest
|
Posted: Mon Nov 23, 2009 2:48 pm Post subject: |
|
|
I have been looking through the FAQs and such as well as see what some of the people do with the possibilities and it amazes me.
Just a question. I really do wish to learn more and I think it may be helpful if I had something more tangible instead of digital. Would a book on scripting be appropriate or what should I look for at the book store? |
|
| Back to top |
|
 |
|