| View previous topic :: View next topic |
| Author |
Message |
Jery
Joined: 08 Mar 2005 Posts: 2
|
Posted: Tue Mar 08, 2005 10:51 pm Post subject: Simplst Question All Day |
|
|
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 |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5390 Location: /b/
|
Posted: Tue Mar 08, 2005 10:58 pm Post subject: |
|
|
| Code: | #Persistent
SetKeyDelay, 2000, -1
Return
#Enter::
Loop, 100
{
Send, {enter}
}
Return |
_________________
 |
|
| Back to top |
|
 |
Jery
Joined: 08 Mar 2005 Posts: 2
|
Posted: Tue Mar 08, 2005 11:02 pm Post subject: Thank you! |
|
|
Thank you!  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Tue Mar 08, 2005 11:32 pm Post subject: |
|
|
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 |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5390 Location: /b/
|
Posted: Wed Mar 09, 2005 12:53 am Post subject: |
|
|
@ jonny
Wouldn't using a sleep affect the performance of other running threads? _________________
 |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Wed Mar 09, 2005 12:57 am Post subject: |
|
|
| 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 |
|
 |
|