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 

Simplst Question All Day

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Jery



Joined: 08 Mar 2005
Posts: 2

PostPosted: Tue Mar 08, 2005 10:51 pm    Post subject: Simplst Question All Day Reply with quote

I am sure that this will be the simplest question here all day...

Just to make this script perfectly clear to me, let's say I want to make a routine that just presses enter 100 times, with a 2-second delay in between, after I press Win+enter once.

Does the script look like this?:

#{enter}::
Loop, 100
{
{enter}
Sleep, 2000
}



Also, is this all that goes in my .ahk file?

Thank you!
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Tue Mar 08, 2005 10:58 pm    Post subject: Reply with quote

Code:
#Persistent
SetKeyDelay, 2000, -1
Return
#Enter::
Loop, 100
{
Send, {enter}
}
Return

_________________

Back to top
View user's profile Send private message Visit poster's website
Jery



Joined: 08 Mar 2005
Posts: 2

PostPosted: Tue Mar 08, 2005 11:02 pm    Post subject: Thank you! Reply with quote

Thank you! Smile
Back to top
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Tue Mar 08, 2005 11:32 pm    Post subject: Reply with quote

SetKeyDelay is one way, but IMO it's kinda beating around the bush. You don't have to modify your original code much, just put it in a send:

Code:
#enter::
Loop, 100
{
send,{enter}
Sleep, 2000
}
Back to top
View user's profile Send private message
Titan



Joined: 11 Aug 2004
Posts: 5390
Location: /b/

PostPosted: Wed Mar 09, 2005 12:53 am    Post subject: Reply with quote

@ jonny
Wouldn't using a sleep affect the performance of other running threads?
_________________

Back to top
View user's profile Send private message Visit poster's website
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Wed Mar 09, 2005 12:57 am    Post subject: Reply with quote

If anything, it would improve the performance of any other running threads. Sleep takes up very few cycles. I'd imagine SetKeyDelay uses sleep internally anyway, but explicitly using it is a bit cleaner.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   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