KILL AN APP - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4) +---- Forum: Scripting (/forumdisplay.php?fid=39) +----- Thread: KILL AN APP (/showthread.php?tid=61972) KILL AN APP by novolo on 06-29-2006 at 02:30 AM
hi, i made script to run applications through commands.. now, i was wondering, is there a way to kill an external application through sript? RE: KILL AN APP by ShawnZ on 06-29-2006 at 02:40 AM new ActiveXObject("WScript.Shell").Run("taskkill /f /im" + IMAGE_NAME) RE: KILL AN APP by ddunk on 06-29-2006 at 02:45 AM
quote:taskkill isn't in XP Home, silly boy. RE: KILL AN APP by cooldude_i06 on 06-29-2006 at 04:57 AM you can include taskkill.exe with the script cant you? RE: KILL AN APP by matty on 06-29-2006 at 05:02 AM
quote:No it wont run on a Windows XP Home installation. RE: KILL AN APP by ddunk on 06-29-2006 at 05:05 AM
quote:Actually, it does. E:\Program Files\mirc\download>taskkill.exe /im editplus.exe SUCCESS: The process "editplus.exe" with PID 1804 has been terminated. RE: KILL AN APP by matty on 06-29-2006 at 05:11 AM
quote:Hmmm thats the gay cause when I last tried it, it didn't work. Anyways you can do this with the API all you need to know is the handle of the window I will post code for it later. RE: KILL AN APP by ShawnZ on 06-29-2006 at 05:16 AM
quote: oh yeah? what error? RE: KILL AN APP by CookieRevised on 06-29-2006 at 11:48 AM
quote:crappy method to (and the need to) include an external app to kill a task... Use the Windows APIs instead. RE: KILL AN APP by novolo on 06-29-2006 at 01:51 PM could anyone post the script to kill an app with the windows api? RE: KILL AN APP by matty on 06-29-2006 at 02:21 PM
quote:If we do that you wont ever learn. Look up GetWindowThreadProcessId RE: KILL AN APP by novolo on 06-30-2006 at 12:13 AM
i've just entered that link, and sorry to say but i don't understand anything... RE: KILL AN APP by CookieRevised on 06-30-2006 at 04:45 PM Proper code to kill an app is not just one code, it will contain many lines of code though. RE: KILL AN APP by novolo on 06-30-2006 at 06:02 PM ohh, ok, any chance anyone knows how to do it? RE: KILL AN APP by matty on 06-30-2006 at 06:04 PM
quote:It is not that we don't know how to do it, its actually a bit complicated. There are many different ways of doing it for instance you can find the handle of the window, from that get the PID then send terminate process command to force it to close. Not the best way cause it doesn't provide the app enough time to save information. RE: KILL AN APP by ShawnZ on 06-30-2006 at 06:53 PM
it'd be something like RE: KILL AN APP by matty on 06-30-2006 at 11:43 PM
code: This was shown to me by Cook but I am too lazy to convert it to a Plus! script. http://www.andreavb.com/tip020021.html RE: KILL AN APP by novolo on 07-01-2006 at 12:17 AM any chance that this could be coded in plus script? RE: KILL AN APP by dylan! on 07-01-2006 at 12:22 AM
quote:if your not a coder then what good does this do you? and what good would it do you if it was in plus script? if your coding a plus script and all you need is this part... how are you going to do the rest of it? RE: KILL AN APP by novolo on 07-01-2006 at 01:55 AM ok ok , i need this part for a script i made to run applications remotely... the thing is i can run applications remotely from a selected email but i dont know how to kill them... now if there's someone out there who is willing to help me rather than ask if i dont know or why am i doing this, or that i should't ask if i'm not a coder, you'r welcome.. RE: KILL AN APP by cloudhunter on 07-01-2006 at 02:13 AM
I found it pays to experiment, and do a google seach every once in a while. They were merely commenting on your seeming lack of knowledge to do with scripting. RE: KILL AN APP by novolo on 07-01-2006 at 02:29 AM
so, that function will work as it is in plus script... RE: KILL AN APP by cloudhunter on 07-01-2006 at 02:55 AM
Not meaning to get at you, but use your eyes for once. All the information is out there, find it. RE: RE: KILL AN APP by CookieRevised on 07-02-2006 at 03:37 AM
quote:The example shown is not tested, but gives you an idea of what would be involved. Also, the given VB example in that link posted by Matty (which I gave to him among other links) is a nice example but the code contains a few useless things and also lacks the part where you actually try to close the application in a not forcefull way as you should always do that first. quote:No, as that should be common programming knowledge. The Scripting Documentation is meant to give info on the Messenger Plus! objects and stuff, it isn't a general "how do I program" tutorial. A Window handle (hWnd) is unique for each window, an application can have many windows, or even no windows at all. And these window handles are not fixed numbers, they are assigned and removed on the fly and thus change each time. To know the window handle for a given process name you need a bunch of other code. Note that different processes can have the same name, so you should loop them all. And also, note that a single process/application can contain many windows, and you will never know what window is the main window. So in fact you even need to get all window handles for a given module and process them all (in order to let the application close properly first, before forcing the process to close). RE: KILL AN APP by novolo on 07-02-2006 at 05:22 PM
oh , then i think i can't do this.. i thought that the hWnd was always the same for an app, for example, my script opens the windows media player, or performs a scan with norton antivirus, so i thought that if i found out what's their hWnd, i could always kill those apps... RE: KILL AN APP by matty on 07-02-2006 at 06:55 PM
quote:Actually Cook it is |