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 

Loop
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Maiyr
Guest





PostPosted: Sun Nov 22, 2009 12:22 am    Post subject: Loop Reply with quote

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





PostPosted: Sun Nov 22, 2009 12:24 am    Post subject: Reply with quote

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

PostPosted: Sun Nov 22, 2009 2:17 am    Post subject: Reply with quote

yes. Although i'd use Sleep and send.

Code:

loop, {
Send ;whatever you plan on sending.
Sleep 1000 ;every 1000 is a second

}



This is the minimal structure you're looking for. Read up the documentation more, and if you have trouble, post your attempts.

http://www.autohotkey.com/docs/commands/Loop.htm

http://www.autohotkey.com/docs/commands/Sleep.htm

http://www.autohotkey.com/docs/commands/Send.htm
Back to top
View user's profile Send private message Yahoo Messenger
Maiyr
Guest





PostPosted: Sun Nov 22, 2009 1:07 pm    Post subject: Reply with quote

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





PostPosted: Sun Nov 22, 2009 1:12 pm    Post subject: Reply with quote

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

PostPosted: Sun Nov 22, 2009 1:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
wooly_sammoth



Joined: 12 May 2009
Posts: 634
Location: Gloucester UK

PostPosted: Sun Nov 22, 2009 3:51 pm    Post subject: Reply with quote

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





PostPosted: Sun Nov 22, 2009 4:08 pm    Post subject: Reply with quote

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

PostPosted: Sun Nov 22, 2009 4:27 pm    Post subject: Reply with quote

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





PostPosted: Sun Nov 22, 2009 4:33 pm    Post subject: Reply with quote

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






PostPosted: Sun Nov 22, 2009 11:24 pm    Post subject: Reply with quote

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

PostPosted: Sun Nov 22, 2009 11:55 pm    Post subject: Reply with quote

You might ant to take a look at this as it addresses what you are trying to do

http://www.autohotkey.com/docs/FAQ.htm#repeat
Back to top
View user's profile Send private message Visit poster's website
Maiyr
Guest





PostPosted: Mon Nov 23, 2009 1:12 am    Post subject: Reply with quote

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

PostPosted: Mon Nov 23, 2009 2:43 am    Post subject: Reply with quote

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
View user's profile Send private message
maiyr
Guest





PostPosted: Mon Nov 23, 2009 2:48 pm    Post subject: Reply with quote

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

 
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