 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
nick
Joined: 24 Aug 2005 Posts: 549 Location: Berlin / Germany
|
Posted: Thu Mar 27, 2008 4:50 pm Post subject: AHK 1.0.47.06 - Bug in Process, Waitclose ? |
|
|
Hello,
this simple script | Code: | #NoEnv
Loop,
{
Process, Wait, AutoHotkey.exe
Process, WaitClose, AutoHotkey.exe
}
ExitApp | produces a CPU load about 30 % on my office system.
Has anyone any idea why? Maybe a bug? _________________ nick  |
|
| Back to top |
|
 |
Oberon
Joined: 18 Feb 2008 Posts: 442
|
Posted: Thu Mar 27, 2008 4:51 pm Post subject: Re: AHK 1.0.47.06 - Bug in Process, Waitclose ? |
|
|
| nick wrote: | | Has anyone any idea why? Maybe a bug? | You haven't put any sleeps in your loop so it runs at extremely high frequency. This is not a bug, just bad practice. |
|
| Back to top |
|
 |
nick
Joined: 24 Aug 2005 Posts: 549 Location: Berlin / Germany
|
Posted: Thu Mar 27, 2008 4:58 pm Post subject: |
|
|
| Oberon wrote: | | You haven't put any sleeps in your loop so it runs at extremely high frequency. This is not a bug, just bad practice. |
| AHK Helpfile wrote: | Waits up to Param3 seconds (can contain a decimal point) for a matching process to exist. If Param3 is omitted, the command will wait indefinitely.
For Wait and WaitClose: Processes are checked every 100 milliseconds; the moment the condition is satisfied, the command stops waiting. In other words, rather than waiting for the timeout to expire, it immediately sets ErrorLevel as described above, then continues execution of the script. Also, while the command is in a waiting state, new threads can be launched via hotkey, custom menu item, or timer. |
_________________ nick  |
|
| Back to top |
|
 |
Oberon
Joined: 18 Feb 2008 Posts: 442
|
Posted: Thu Mar 27, 2008 5:17 pm Post subject: |
|
|
| It works for me at 0% load (tested with notepad.exe). Have you tried using Process, Priority, , L and SetBatchLines in your script? |
|
| Back to top |
|
 |
Guest
|
Posted: Sat Feb 06, 2010 11:37 am Post subject: |
|
|
Hi,
I'm encountering an issue about this kind of commands and at the same time I saw this post and thought that this code may need correction :
Instead of this :
| Code: | Loop,
{
Process, Wait, AutoHotkey.exe
Process, WaitClose, AutoHotkey.exe
}
ExitApp |
this is enough :
| Code: |
Process, Wait, AutoHotkey.exe
Process, WaitClose, AutoHotkey.exe
|
No need to Loop then no CPU load.
Because the process command will wait by itself and proceed to the next line when the first contition (AutoHotkey.exe process existing) will be met.
The the second instruction will go to next line (wathever it is) , when the condition (AutoHotkey.exe process closing) will be met too.
Correct me if it's wrong |
|
| Back to top |
|
 |
awannaknow
Joined: 14 Jun 2009 Posts: 324
|
Posted: Sat Feb 06, 2010 11:40 am Post subject: |
|
|
oups, posted unlogged as our often here friend "Guest"
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|