AutoHotkey Community

It is currently May 27th, 2012, 8:31 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: April 2nd, 2006, 3:06 am 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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 April 2nd, 2006, 2:21 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2006, 5:57 am 
- 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


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2006, 1:31 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2006, 2:21 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 2nd, 2006, 7:36 pm 
many thanks.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2006, 6:14 pm 
I upgraded succcessfully to AutoHotKey 1.0.43.03 commenting one of the above double lines.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 3rd, 2006, 6:32 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2006, 4:53 am 
ok


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2006, 8:00 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
evl is right.
Besides, the lines are not identical: "ht_this" vs "hp_this"

_________________
Ciao
toralf
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2006, 10:27 am 
thanks, now I see,
there are no repeating lines.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 4th, 2006, 5:46 pm 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
I picked a good time to write this script - 2 AutoHotkey updates from Chris in as many days :lol: 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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 5th, 2006, 11:37 am 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2006, 4:11 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2006, 11:47 am 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 10th, 2006, 2:24 am 
Offline

Joined: November 11th, 2005, 3:13 am
Posts: 202
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:


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: AndyJenk, Aravind, Google [Bot], hyper_, xXDarknessXx, Yahoo [Bot] and 12 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group