zxcvbnm Posted February 10, 2011 Posted February 10, 2011 I have an autoit application (.exe) resident on a pc (local), this application is called by a program. at the and of the program I need to close this autoit application. So I hooked two autoit application, one at the beginnig and one at the and of the program. I've no problem to launch autoit application at the beginning, but no positive responce about closing application I try with WinClose("Count Down") cause the autoit application contains a timer and in this way I'am sure to kill it Count Down is the name of the GUI of the first autoit application It seems that local pc doesn't find it, if I exec ("Count Down") with double click it runs ok. Any ideas? Thanks
Juvigy Posted February 10, 2011 Posted February 10, 2011 At the end the program closes itself automatically. If it doesnt close then it most likely doesnt finish or get in an infinite loop whithout exit.
zxcvbnm Posted February 10, 2011 Author Posted February 10, 2011 The program and the autoit application are indipendent. Program launch autoit app but doesn't know autoit app. Can I close autoit app looking in win32process?
zxcvbnm Posted February 10, 2011 Author Posted February 10, 2011 I try with this code posted from AdnyS01 Local $hWnd, $title = $sCurrentTitle ; ($sCurrentTitle is defined elsewhere) IF (WinActivate($title, "") <> 0) Then $hWnd = WinGetHandle($title, "") IF (IsHWnd($hWnd)) Then IF (NOT WinClose($hWnd)) Then WinKill($hWnd) IF (WinActivate($title, "") <> 0) Then MsgBox(0, "ERROR", "Cannot kill window") Else MsgBox(0, "INFO", "Killed other window") EndIF Else MsgBox(0, "ERROR", "Cannot get win handle") EndIF EndIF It seems that we can recognise the first autoit application.
Juvigy Posted February 10, 2011 Posted February 10, 2011 You dont get it. The auotoit app will close automatically when it finishes. You dont need to close it.
hannes08 Posted February 10, 2011 Posted February 10, 2011 Hello zxcvbnm, If you use Run() to run the app it returns the PID. You could use the PID to run a ProcessClose(). Regards, Hannes Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
zxcvbnm Posted February 10, 2011 Author Posted February 10, 2011 I need to close it because it countinues to go! It's a timer connected to the program that calls it. So when the program ends I need to close it.
Juvigy Posted February 10, 2011 Posted February 10, 2011 Find it in the taskmanager and do for example "Notepad" : ProcessClose("notepad.exe")
zxcvbnm Posted February 10, 2011 Author Posted February 10, 2011 Thanks Hannes, I don't use Run() Can I introduse it in my timer?
Juvigy Posted February 10, 2011 Posted February 10, 2011 You have 2 programs right ? Lets call them "Main.exe" and "timer.exe" . So you want at the end of main.exe to close timer.exe , right? Just put : ProcessClose("timer.exe") At the end of Main.exe and recompile it and that is all.
zxcvbnm Posted February 10, 2011 Author Posted February 10, 2011 I have one program (auoit indipendent), and two autoit application (first and second)first is a timer, second must be close itI can hook first at the beginning of the program, and it runs okI need to close timer and the and of the program so I need to exec second autoit app at the and of the programbut I can't close first autoit app with the second also using ProcessClose, I don't know why!ProcessClose("timer.exe") runs ok if I use double click on .exe, but called by a programs it doesn't run ok.
Juvigy Posted February 10, 2011 Posted February 10, 2011 Then it has to be something by the way the master program call it. What is the master program and how do you call the autoit exe files ?
zxcvbnm Posted February 10, 2011 Author Posted February 10, 2011 master program is a telephone client that open a pop up to manage phone callsit exec without problems the launch of the timer at the beginning of the calls, but at the end it has to close the timer.I named ProcessClose("timer.exe") : close.exeIt seems that don't recognise the name of the process.
Juvigy Posted February 10, 2011 Posted February 10, 2011 When you have the timer running and open Task manager and go to processes , do you find "timer.exe" somewhere under the "image name" column? (This is for XP for Vista and 7 it may vary a bit)
zxcvbnm Posted February 10, 2011 Author Posted February 10, 2011 yes I find it! (image column)infact if use .exe app to close timer with double click it runs ok.
MHz Posted February 10, 2011 Posted February 10, 2011 timer.exe is perhaps running under another account which is inherited from the telephone application. A possible method to handle timer.exe to exit by itself is to have it look for a flag i.e. an existence of a certain filename or a registry value that when timer.exe sees it, then it will close itself.
zxcvbnm Posted February 10, 2011 Author Posted February 10, 2011 I'mlooking for any possible solution, but what can I do in this way? Which flag?
Juvigy Posted February 10, 2011 Posted February 10, 2011 In the Task manager it would also say which user account it runs on. Check it. Also if there are multiple instances of timer.exe running. Processclose will only close one instance.
Juvigy Posted February 10, 2011 Posted February 10, 2011 What OS do you have? Is the Phone application running on local user too ?
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