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 

AutoHotkey Script Restarter v1.01
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
evl



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Sun Apr 02, 2006 2:06 am    Post subject: AutoHotkey Script Restarter v1.01 Reply with quote

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 Wink

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





PostPosted: Sun Apr 02, 2006 4:57 am    Post subject: Reply with quote

- 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

PostPosted: Sun Apr 02, 2006 12:31 pm    Post subject: Reply with quote

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



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Sun Apr 02, 2006 1:21 pm    Post subject: Reply with quote

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





PostPosted: Sun Apr 02, 2006 6:36 pm    Post subject: Reply with quote

many thanks.
Back to top
robiandi
Guest





PostPosted: Mon Apr 03, 2006 5:14 pm    Post subject: Reply with quote

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

PostPosted: Mon Apr 03, 2006 5:32 pm    Post subject: Reply with quote

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





PostPosted: Tue Apr 04, 2006 3:53 am    Post subject: Reply with quote

ok
Back to top
toralf



Joined: 31 Jan 2005
Posts: 3910
Location: Bremen, Germany

PostPosted: Tue Apr 04, 2006 7:00 am    Post subject: Reply with quote

evl is right.
Besides, the lines are not identical: "ht_this" vs "hp_this"
_________________
Ciao
toralf
Back to top
View user's profile Send private message Send e-mail Visit poster's website
robiandi
Guest





PostPosted: Tue Apr 04, 2006 9:27 am    Post subject: Reply with quote

thanks, now I see,
there are no repeating lines.
Back to top
evl



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Tue Apr 04, 2006 4:46 pm    Post subject: Reply with quote

I picked a good time to write this script - 2 AutoHotkey updates from Chris in as many days Laughing 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
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10716

PostPosted: Wed Apr 05, 2006 10:37 am    Post subject: Reply with quote

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



Joined: 11 Nov 2005
Posts: 202

PostPosted: Thu Apr 06, 2006 3:11 am    Post subject: Reply with quote

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



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Thu Apr 06, 2006 10:47 am    Post subject: Reply with quote

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



Joined: 11 Nov 2005
Posts: 202

PostPosted: Mon Apr 10, 2006 1:24 am    Post subject: Reply with quote

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. Idea
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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