 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Sun Nov 04, 2007 1:24 pm Post subject: Force Shutdown a program |
|
|
Dear all,
I'm a newbie in AHK, so please help me how to close a program without any asking for example when a word document is running, how to close the document but not display a dialog (ask to save document or not).
Please help me.Thanks |
|
| Back to top |
|
 |
charmander91
Joined: 27 Oct 2007 Posts: 37 Location: olney, maryland
|
Posted: Sun Nov 04, 2007 10:18 pm Post subject: |
|
|
ooh i actually have this, i did it to close somoenes document when they press a, but i made it so that when u exit and it says, "changes have been made, would you like to save?" it tabs to "No" and presses enter. here's what i have, maybe u can make an if/then statement to make it see if word is open, but im too lazy to try it out.
| Code: |
~a::
sleep, 5000
Send, {ALTDOWN}{F4}{ALTUP}{TAB}{ENTER}
; or
; Send, !{f4}{tab}{enter}
Return
|
_________________ ehh... ill draw a pic of a charmander later |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Nov 05, 2007 4:02 am Post subject: |
|
|
| charmander91 wrote: | ooh i actually have this, i did it to close somoenes document when they press a, but i made it so that when u exit and it says, "changes have been made, would you like to save?" it tabs to "No" and presses enter. here's what i have, maybe u can make an if/then statement to make it see if word is open, but im too lazy to try it out.
| Code: |
~a::
sleep, 5000
Send, {ALTDOWN}{F4}{ALTUP}{TAB}{ENTER}
; or
; Send, !{f4}{tab}{enter}
Return
|
|
Thank you so much, but it is not what i mean, I want to close immediately a window without displaying dialog for asking.
Thanks |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
Posted: Mon Nov 05, 2007 4:07 am Post subject: |
|
|
| Process, Close |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Nov 05, 2007 10:51 am Post subject: |
|
|
But it still display dialog ask to save the changes or not. So it is not what I expected.
Thanks, |
|
| Back to top |
|
 |
kidmar
Joined: 04 Oct 2007 Posts: 30
|
Posted: Mon Nov 05, 2007 11:14 am Post subject: |
|
|
| Did you try the windows' Kill.exe? |
|
| Back to top |
|
 |
kidmar
Joined: 04 Oct 2007 Posts: 30
|
Posted: Mon Nov 05, 2007 1:18 pm Post subject: |
|
|
| try WinKill command too |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
Posted: Mon Nov 05, 2007 9:19 pm Post subject: |
|
|
| Anonymous wrote: |
But it still display dialog ask to save the changes or not. So it is not what I expected.
Thanks, | Strange, since Notepad doesn't. I guess you'll have to automate closing the dialog. |
|
| Back to top |
|
 |
charmander91
Joined: 27 Oct 2007 Posts: 37 Location: olney, maryland
|
Posted: Mon Nov 05, 2007 11:40 pm Post subject: |
|
|
hmm... try this then
| Code: |
~a::
Send, {ALTDOWN}{F4}{ALTUP}{TAB}{ENTER}
; or
; Send, !{f4}{tab}{enter}
Return
|
this will only work with microsoft word though. you may need to do something where it recognizes the title. _________________ ehh... ill draw a pic of a charmander later |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Nov 07, 2007 4:01 am Post subject: |
|
|
| kidmar wrote: | | try WinKill command too |
I opened a Notepad document, written somethings (no save) then tried this ahk code:
[/code]
IfWinExist, Untitled - Notepad
WinKill ; use the window found above
else
WinKill, Calculator
[code]
But the dialog displayed, beside I don't want to use followed code to do:
~a::
sleep, 5000
Send, {ALTDOWN}{F4}{ALTUP}{TAB}{ENTER}
; or
; Send, !{f4}{tab}{enter}
Return
I want to close immediately document (or process), Notepad program for instance from the operation system, bypass the controling of sofware (Notepad program).
Thanks, |
|
| Back to top |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
Posted: Wed Nov 07, 2007 5:07 am Post subject: |
|
|
If Process, Close doesn't work, try this:
| Code: | | Run, taskkill /F /PID %pid%,, Hide | ...where pid contains the Process ID. Alternately, identify by process name:
| Code: | | Run, taskkill /F /IM winword.exe |
XP Pro, 2003 and Vista have taskkill; I'm not sure about other versions.
If you don't have taskkill, search for PsKill. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Nov 07, 2007 5:55 am Post subject: |
|
|
| lexikos wrote: | If Process, Close doesn't work, try this:
| Code: | | Run, taskkill /F /PID %pid%,, Hide | ...where pid contains the Process ID. Alternately, identify by process name:
| Code: | | Run, taskkill /F /IM winword.exe |
XP Pro, 2003 and Vista have taskkill; I'm not sure about other versions.
If you don't have taskkill, search for PsKill. |
yeahhhhhhhhhh, that is what i expected, thank you very much, especially Lexikos and Kidmar, thousands of kisses to you. |
|
| 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
|