sigil Posted January 29, 2010 Share Posted January 29, 2010 I'm using the ExcelCom_UDF. One of the script's actions is to run a macro in Excel; this macro takes several seconds to complete, but for various server-related issues, the length of time to run the macro varies widely, anywhere between 2 to 15 seconds usually. Does AutoIt have a way of detecting that an Excel macro is still running? or is there an Excel function for doing so that I can call through COM? I guess the code would look like this if there's a COM option: $oExcel=_ExcelBookOpen($filepath) $oExcel.run("myMacro") while $oExcel.isRunning("myMacro") ;or whatever the property is called wend rest_of_the_script() Link to comment Share on other sites More sharing options...
picaxe Posted January 30, 2010 Share Posted January 30, 2010 Does AutoIt have a way of detecting that an Excel macro is still running? or is there an Excel function for doing so that I can call through COM?One way is to create a mutex in your excel macro and check for it in your AutoIt code. See these AutoIt and vba threads. Link to comment Share on other sites More sharing options...
Juvigy Posted February 1, 2010 Share Posted February 1, 2010 Why do you bother with "$oExcel.isRunning("myMacro") ;or whatever the property is called" ? When you execute the macro with $oExcel.run("myMacro") the control is returned to the AutoIt when the macro finishes. So if you put a msgbox right after $oExcel.run("myMacro") that is exactly the moment the macro has terminated. Link to comment Share on other sites More sharing options...
sigil Posted February 1, 2010 Author Share Posted February 1, 2010 Why do you bother with "$oExcel.isRunning("myMacro") ;or whatever the property is called" ?When you execute the macro with $oExcel.run("myMacro") the control is returned to the AutoIt when the macro finishes.So if you put a msgbox right after $oExcel.run("myMacro") that is exactly the moment the macro has terminated.Actually, since posting this I found out I can't use $oExcel.run("myMacro"). I'm filling in Excel values by doing ControlClick on a button in another application that sends info from a database into an open Excel spreadsheet of a certain filename. So I need to know when the other application has finished filling in the details.One way I was thinking I could do it is, when I click the other application, the pointer turns into a wait-signal (this application's equivalent of the hourglass) until it's finished porting the data to Excel. Is there a way that I can check to see if the wait-signal is still active? Link to comment Share on other sites More sharing options...
Juvigy Posted February 2, 2010 Share Posted February 2, 2010 Now this is different.Is there any way you can check if the data has been exported by checking some values in the Excel? What is the other application - Oracle?SAP?BO?Maybe it has its own object model? Link to comment Share on other sites More sharing options...
sigil Posted February 4, 2010 Author Share Posted February 4, 2010 Now this is different.Is there any way you can check if the data has been exported by checking some values in the Excel?What is the other application - Oracle?SAP?BO?Maybe it has its own object model?Looks like I might have to continuously poll Excel, check to see if some cells have changed. The other application is some flavor of call center client that I haven't been able to find any support or description of an object model on the web. I think it sends requests to an oracle server on the back end somewhere, but not at a direct user interface level. the company went out of business... 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