 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Fri Jan 28, 2005 4:58 pm Post subject: Closing applications |
|
|
I want to close some applications (I have started) at the end of the script.
Currently I do it using "Process Close ..." but this is a hard kill. Would be nice to close it softly (application should be able to ask for saving files etc.)
like it is done by WinClose if used with the main window (similar to Delphis' Application.Terminate ).
example:
run, helper1.exe ,,, PID1
run, helper2.exe ,,, PID2
runwait, mainapp.exe
process, close, PID2
process, close, PID1
Leo. |
|
| Back to top |
|
 |
leonix
Joined: 28 Jan 2005 Posts: 2
|
Posted: Fri Jan 28, 2005 5:00 pm Post subject: |
|
|
uups I forgot to login. It was me that posted that question
Leo. |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Fri Jan 28, 2005 5:28 pm Post subject: |
|
|
| Quote: | WinClose
--------------------------------------------------------------------------------
Closes a window.
WinClose [, WinTitle, WinText, SecondsToWait, ExcludeTitle, ExcludeText]
This command sends a close message to a window. The result depends on the window (it may ask to save data, etc.)
| It (tries to) close every window. If the window is named "Program Manager" (which is the Desktop) then it would offer to shutdown the system.
It's bad step-brother:
| Quote: | WinKill
--------------------------------------------------------------------------------
Forces a window to close.
WinKill [, WinTitle, WinText, SecondsToWait, ExcludeTitle, ExcludeText] |
OK. Let's go back to RTFM  |
|
| Back to top |
|
 |
Guest
|
Posted: Fri Jan 28, 2005 6:39 pm Post subject: |
|
|
Bobo,
this was not my question. I want to do
WinClose PID
I do not have the WinTitle of my application;
it can be that it is all the same WinTitle or WinText
with the PID it would be selectively exactely the window I want.
You understand!?
Leo.  |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10467
|
Posted: Fri Jan 28, 2005 6:56 pm Post subject: |
|
|
Thanks for clarifying.
If there is only one instance of the target application in existence, I recommend using "WinClose ahk_class ClassName" (as shown by Window Spy).
If there is more than one instance, you can discover the windows that belong to a particular PID with the following:
http://www.autohotkey.com/forum/viewtopic.php?t=1367 |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1717
|
Posted: Fri Jan 28, 2005 6:59 pm Post subject: |
|
|
if u know the PID then use a loop to get the PIDs of all (matching) windows and when its found, get its ahk_id and use winclose. _________________
 |
|
| 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
|