jnash67 Posted September 23, 2010 Share Posted September 23, 2010 I am creating an excel instance and waiting for it to close. However, when the excel quits through either the file menu or through an application.quit VBA call, the window disappears but it doesn't really die. In the following code I never get to the msgbox until I actually kill the process with process manager. Local $oe = _ExcelBookNew() $oe.caption = "123" WinWaitClose("123") MsgBox(0, "bye", "bye") Exit I haven't found any way to get Excel to actually fully die. How can I get this to happen? Link to comment Share on other sites More sharing options...
GEOSoft Posted September 23, 2010 Share Posted September 23, 2010 You might be better off with ProcessWaitClose() George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
Juvigy Posted September 23, 2010 Share Posted September 23, 2010 Check those out: $oExcel.Workbooks.Close $oExcel.Application.Quit Link to comment Share on other sites More sharing options...
jnash67 Posted September 23, 2010 Author Share Posted September 23, 2010 Check those out: $oExcel.Workbooks.Close $oExcel.Application.Quit ProcessWaitClose has the same problem as WinWaitClose. It's not closing -- neither the window or the process. So the below code never gets to the Msgbox either: Local $oe = _ExcelBookNew() $oe.caption = "123" Local $oep = WinGetProcess("123") ProcessWaitClose($oep) MsgBox(0, "bye", "bye") Exit For $oExcel.Workbooks.Close and $oExcel.Application.Quit, I know I can kill Excel from AutoIt. The issue is, I need AutoIt to wait until the user kills Excel. However, even when the user kills Excel, it doesn't really die. The window and process are still there in some form or another, although the excel window in the UI seems to have disappeared. Link to comment Share on other sites More sharing options...
l3ill Posted September 23, 2010 Share Posted September 23, 2010 This is a bug (at least in my opinion) if you hold down the shift when closing it should kill it off good My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
water Posted September 24, 2010 Share Posted September 24, 2010 I had a similar problem when running the 32 bit version of Office on a 64 bit operating system (Windows 7) and executing/compiling the script for 64 bit.When compiling the script for 32 bit everything was running fine again. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
jnash67 Posted September 24, 2010 Author Share Posted September 24, 2010 (edited) The solution to this issue is for AutoIt to release the object variable as follows: Local $oe = _ExcelBookNew() $oe.caption = "123" $oe = 0 ; this releases the object WinWaitClose("123") MsgBox(0, "bye", "bye") Exit If you store the HWND or PID before releasing (with WinGetHandle or WinGetProcess), you can retrieve the object using WinAPI functions like _WinAPI_Getwindow. I would still consider this a "bug" because the AutoIt documentation says you no longer need to release objects (although this is in reference to memory management). Edited September 24, 2010 by jnash67 Link to comment Share on other sites More sharing options...
jnash67 Posted September 24, 2010 Author Share Posted September 24, 2010 I had a similar problem when running the 32 bit version of Office on a 64 bit operating system (Windows 7) and executing/compiling the script for 64 bit.When compiling the script for 32 bit everything was running fine again.Everything I did was in a 32-bit environment 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