NSearch Posted May 10, 2005 Share Posted May 10, 2005 (edited) WinGetTitle("Microsoft Excel - $duplicate_report_name .xls", "") How do I seperate the variable $duplicate_report_name from Microsoft Excel - & .xls? Thanks Edited May 10, 2005 by NSearch Link to comment Share on other sites More sharing options...
MHz Posted May 10, 2005 Share Posted May 10, 2005 (edited) WinGetTitle("Microsoft Excel - " & $duplicate_report_name & ".xls", "") Use & to join variable to strings, as shown. Edited May 10, 2005 by MHz Link to comment Share on other sites More sharing options...
NSearch Posted May 10, 2005 Author Share Posted May 10, 2005 Thank you Link to comment Share on other sites More sharing options...
NSearch Posted May 10, 2005 Author Share Posted May 10, 2005 Mhz, Do you know how I can wait for an excel spreadsheet to finish saving before I end the process. I am trying to do these two things, but they are not working. The second bit of code will work, but I dont want to set a sleep time, because some files may take longer to save than other. Thanks. 1----------------------------------------------------------------------- WinWaitNotActive("Microsoft Excel - " & $duplicate_report_name & ".xls") $PID10 = ProcessExists("EXCEL.EXE") If $PID10 Then ProcessClose($PID10) ---------------------------------------------------------------------- 2---------------------------------------------------------------------- While $click_flag1 = 0 If WinGetTitle("Microsoft Excel - " & $duplicate_report_name & ".xls", "") = 1 Then $click_flag1 = 1 Sleep(1500) $PID10 = ProcessExists("EXCEL.EXE") If $PID10 Then ProcessClose($PID10) Endif WEnd --------------------------------------------------------------- Link to comment Share on other sites More sharing options...
steveR Posted May 10, 2005 Share Posted May 10, 2005 COM is supported in the beta and looking through the Excel COM, I see there is a property of the WorkBook class:Saved (Boolean): Gets or sets the saved state of the workbook. If the user has made modifications to the workbook's contents or structure, the Saved property is True. Attempting to close the workbook or quit Excel will cause an alert to appear, prompting you to save the workbook (unless you've set the Application.DisplayAlerts property to False). If you set the Saved property value to False in your code, Excel will treat your workbook as if it had already been saved, and not prompt you to save it again.Don't know if that can be of any use to you. Here is the full article:http://msdn.microsoft.com/library/default....ml/ExcelObj.asp AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass. Link to comment Share on other sites More sharing options...
jefhal Posted May 12, 2005 Share Posted May 12, 2005 Mhz, Do you know how I can wait for an excel spreadsheet to finish saving before I end the process.The following code looks for the word "Ready" to appear on the status bar of the Excel screen and waits until it sees it to move on to the next command. It's ugly, but it works for McAfee AV and Defrag. You need to replace "yourfilename" with the variable that you are already using, plus you need to find the exact location where StringInStr finds "Ready" on your Excel screen. Replace the XX that I put in the code with your value. The While loop will keep running until it sees "Ready" at that location in $text.dim $text = "" ; Initialize $text $text = WinGetText("Microsoft Excel - yourfilename","") ; Keep checking $text to see if "Ready" exists in it While StringInStr($text,"Microsoft Excel - yourfilename") <> XX; XX is the numeric location where you find "Ready" on a dry run of StringInStr ; Read $text again $text = WinGetText("Microsoft Excel - yourfilename","") ;MsgBox(0, "Value of $text is:", $text) ; for debug WEnd ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format 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