| View previous topic :: View next topic |
| Author |
Message |
evl
Joined: 24 Aug 2005 Posts: 1237
|
Posted: Sun Apr 02, 2006 2:06 am Post subject: AutoHotkey Script Restarter v1.01 |
|
|
I usually have quite a few uncompiled (.ahk format) scripts running and these need to be closed before I can update to a new version of AutoHotkey (since uncompiled scripts make use of AutoHotkey.exe). I've updated it to also be able to just close selected processes.
This script shows a list of all such running scripts and has a button for stopping them and a button for restarting them (after having updated AutoHotkey).
Save the script from the link below, but note that is MUST be compiled before use otherwise AutoHotkey.exe will still be in use, since the script can't stop itself
AutoHotkey Script Restarter
Updated to v1.01:
- Selected script processes can be ended (e.g. tidy up after testing some scripts out).
- Option to also close the help file (for updating).
- Some small fixes.
Thanks go to Shimanov for his code to retrieve the process information and the command line parameters they were run with.
Last edited by evl on Sun Apr 02, 2006 1:21 pm; edited 1 time in total |
|
| Back to top |
|
 |
robiandi Guest
|
Posted: Sun Apr 02, 2006 4:57 am Post subject: |
|
|
- A repeating line, is this a typo ? | Code: | GuiClose:
GuiEscape:
HandleExit:
DllCall( "CloseHandle", "uint", ht_this )
DllCall( "CloseHandle", "uint", hp_this )
ExitApp
| - Perhaps one should/could add AutoHotkey.chm to the list of running processes |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1237
|
Posted: Sun Apr 02, 2006 12:31 pm Post subject: |
|
|
That's part of Shimanov's code and I don't think it's a typo.
I thought about also closing the manual but wasn't sure. I'll probably add a checkbox for whether to close it or not, thanks for reminding me about that. |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1237
|
Posted: Sun Apr 02, 2006 1:21 pm Post subject: |
|
|
Updated to v1.01 (see 1st post):
- Selected script processes can be ended (e.g. tidy up after testing some scripts out).
- Option to also close the help file (for updating).
- Some small fixes. |
|
| Back to top |
|
 |
robiandi Guest
|
Posted: Sun Apr 02, 2006 6:36 pm Post subject: |
|
|
| many thanks. |
|
| Back to top |
|
 |
robiandi Guest
|
Posted: Mon Apr 03, 2006 5:14 pm Post subject: |
|
|
| I upgraded succcessfully to AutoHotKey 1.0.43.03 commenting one of the above double lines. |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1237
|
Posted: Mon Apr 03, 2006 5:32 pm Post subject: |
|
|
| I just updated too. Those lines are not doubled as far as I'm aware - they're for closing handles that the script creates during its running. Although it will function without both of them, it would leave behind un-closed handles to processes after the script exits. That's my understanding, but it's shimanov's bit of script. |
|
| Back to top |
|
 |
robiandi Guest
|
Posted: Tue Apr 04, 2006 3:53 am Post subject: |
|
|
| ok |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3910 Location: Bremen, Germany
|
Posted: Tue Apr 04, 2006 7:00 am Post subject: |
|
|
evl is right.
Besides, the lines are not identical: "ht_this" vs "hp_this" _________________ Ciao
toralf  |
|
| Back to top |
|
 |
robiandi Guest
|
Posted: Tue Apr 04, 2006 9:27 am Post subject: |
|
|
thanks, now I see,
there are no repeating lines. |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1237
|
Posted: Tue Apr 04, 2006 4:46 pm Post subject: |
|
|
I picked a good time to write this script - 2 AutoHotkey updates from Chris in as many days Maybe Chris could integrate something like this into the installer itself? I'm not sure if there would be a convenient way of doing it though because I have no experience of packaging software with an installer. |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10716
|
Posted: Wed Apr 05, 2006 10:37 am Post subject: |
|
|
| Some kind of auto-update or update-check is already on the to-do list due to repeated suggestions from others over the past two years. Thanks. |
|
| Back to top |
|
 |
badmojo
Joined: 11 Nov 2005 Posts: 202
|
Posted: Thu Apr 06, 2006 3:11 am Post subject: |
|
|
very useful script, but i had run into a problem because i use the zipped version of AHK.
I had this confirmed by checking the help file. It has to do with the built-in variable, A_AhkPath which, in a compiled script, looks for AutoHotkey.exe here -> HKLM\SOFTWARE\AutoHotkey\InstallDir. Since there will be no such key in the registry, A_AhkPath will be blank and therefore the script would raise an error.
So this is my work-around, in case anyone else has had same the problem...
| Code: | ; If compiled, put AHK.exe path into this variable, AHKPath
; because the internal var A_AhkPath would be empty
AHKPath=%ProgramFiles%\AutoHotkey\AutoHotkey.exe
...
;Run, %A_LoopField%, %Script_WorkingDir%
Run, %AHKPath% %A_LoopField% |
badmojo |
|
| Back to top |
|
 |
evl
Joined: 24 Aug 2005 Posts: 1237
|
Posted: Thu Apr 06, 2006 10:47 am Post subject: |
|
|
I didn't use A_AhkPath anywhere in the script. The script retrieves the path to the .ahk file and just runs that, with the same directory as its working directory (very important or else you get your ini files not saved in the right place etc). Nowhere does it include the path to autohotkey.exe.
I can only think that you don't have ahk files associated to run when double-clicked? |
|
| Back to top |
|
 |
badmojo
Joined: 11 Nov 2005 Posts: 202
|
Posted: Mon Apr 10, 2006 1:24 am Post subject: |
|
|
| evl wrote: | | I can only think that you don't have ahk files associated to run when double-clicked? |
you're right, i don't have ahk files associated with AHK. that's why i had to modify this line:
| Code: | ;Run, %A_LoopField%, %Script_WorkingDir%
Run, %A_AHKPath% %A_LoopField% |
but of course, in my case A_AhkPath is blank, therefore i had to add a variable containing the path to AHK's exe. sorry for not clarifying but i thought that by mentioning that i was using the zipped version of AHK, one would assume this would be the case...
anyway, tks for the super-cool script.  |
|
| Back to top |
|
 |
|