Mica Posted November 3, 2009 Posted November 3, 2009 Hello, i'd like to know if it is possible as soon as the script gets killed (crtl+alt+del method) manualy. It can close a process aswell. Like a little mockup idea: 1) Kill Script process 2) Kill Running Process of a program the script ran. (like some sort of last event handler or some kind?) Thanks in advance
Manjish Posted November 3, 2009 Posted November 3, 2009 (edited) From the help file: Opt("OnExitFunc", "endscript") MsgBox(0,"","first statement") Func endscript() MsgBox(0,"","after last statement " & @EXITMETHOD) ;killprocess() EndFunc Define what process you want killed in endscript function Edited November 3, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
martin Posted November 3, 2009 Posted November 3, 2009 Thanks alot A bit premature If the script is ended with Ctrl Alt Del as you said then the exe is stopped from running, so how can it execute the onexit function?Manjish didn't try his own suggestion or he would have found it doesn't work.If you call exe B from exe A and want B to end when A ends then you could make B check that A is alive and if not then exit. ProcessExists will do the job. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Manjish Posted November 3, 2009 Posted November 3, 2009 @ Martin, True. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Mat Posted November 3, 2009 Posted November 3, 2009 Are you talking about a different process, or an autoit one you have created? One way to do it is run a seperate small script... (or be clever) If WinExists ("Process killer on exit example") Then Exit 0 * _MainProcess () AutoitWinSetTitle ("Process killer on exit example") $iPid = Run ("""" & @AutoitExe & """ """ & @ScriptFullPath & """") While ProcessExists ($iPid) Sleep (10) WEnd ProcessClose ("The process!!") Exit Func _MainProcess () While 1 Tooltip ("Running") WEnd EndFunc ; ==> _MainProcess This will create 2 seperate processes though, so you must make sure that you colse the right one. Mat AutoIt Project Listing
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now