Kangaroo Posted September 26, 2009 Share Posted September 26, 2009 (edited) I didnt use AutoIt for a while, but to autmate some administrative tasks I downloaded the current version today and started some coding.But it seems I lost my touch, because I cant explain why WinClose seems to work fine for me and WinWaitClose doesnt.If I start calc.exe ;-- close Window WinClose("Rechner") works fine and closes the calculators window.But ;-- close Window WinWaitClose("Rechner") just sits there forever.What's wrong here ? Edited September 26, 2009 by Kangaroo Link to comment Share on other sites More sharing options...
andygo Posted September 26, 2009 Share Posted September 26, 2009 moin moin, das winwaitclose heisst das dein script wartet bis der rechner nicht mehr existiert.... nich das du ihn schliesst. translation 4 all: winwaitclose just waits till "rechner" isnt present anymore, it dont close "rechner" Link to comment Share on other sites More sharing options...
Kangaroo Posted September 26, 2009 Author Share Posted September 26, 2009 hmpfh, of course ... should read the help file more closely in the future. thx andygo Link to comment Share on other sites More sharing options...
Crash Posted September 26, 2009 Share Posted September 26, 2009 Good job, Andygo! JPGRAR | Mouse Lock | My website | Thanks so much for your help! ❤️ Link to comment Share on other sites More sharing options...
Crash Posted September 26, 2009 Share Posted September 26, 2009 But I think ProcessClose ("calc.exe") would be a better one, because it closes the process, not closes the window; your script MAY not work on other computers, because the language is different. So... I advise you to always use the process name; the language may be different, but the process name is not. JPGRAR | Mouse Lock | My website | Thanks so much for your help! ❤️ Link to comment Share on other sites More sharing options...
herewasplato Posted September 26, 2009 Share Posted September 26, 2009 But I think ProcessClose ("calc.exe") would be a better one, because it closes the process, not closes the window; your script MAY not work on other computers, because the language is different. So... I advise you to always use the process name; the language may be different, but the process name is not. A belated welcome to the forums. WinClose is "kinder" to the process being closed. ProcessClose does not let the app warn the user of any unsaved data. ProcessClose also prevents apps from writing some data to ini files or the the registry. It is not the preferred method... but for cacl.exe, it does not matter which you use. Unless you only want to close the cacl.exe that the script started and not the one that the user might have open :-) You raise a good point about languages and window titles - but there are ways around that. i.e. the OP mentioned "If I start calc.exe" - that could mean that the script started the app of interest. If so, then the script can know the Process ID of the app that it started... ...and from that, the handles of the windows it spawns. Window handles can be used in the place of window titles in the Win....() functions: http://www.autoitscript.com/fileman/users/Helge/udfs/_ProcessGetHWnd.au3 If the script did not start the app that it is attempting to close, then use ProcessExiststo get the PID of calc.exe or notepad.exe [size="1"][font="Arial"].[u].[/u][/font][/size] Link to comment Share on other sites More sharing options...
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