I use a program named ShowCase (SPSS) to query data from our AS/400 and return it to an Excel workbook. After the data is returned, it triggers a macro refreshing all the PivotTables in the workbook.
The script now correctly starts the workbook, chooses to Refresh the Data, logs into ShowCase server, logs into the ODBC connection, and returns the data to Excel. The status bar changes from Running Showcase query, to Restoring Data, to Ready.
I've been trying to find the right way to recognize that control has passed back to Excel without looking for a change in the screen image; but, I'm not getting it right.
I've tried using SetFocus with WaitReady>1; but, the script is not finishing; so, I must be missing something.
Can someone point me in the right direction?
Thanks.
Carl
[/code]
Recognizing when an Excel Macro has finished.
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
I would use WaitScreenImage
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
First, there's no need to write a separate script to capture the screen image. Just use the image capture tool. In the editor select Tools/Image Capture Tool or if using the command builder you will see a capture button on the WaitScreenImage dialog.
Second, there's no need to use the entire screen. I would simply capture the area of the status bar that signifies process completion - or whatever part of the screen tells me the process is complete. This can then be used regardless of window size or placemenet and regardless of screen dimensions. But if the color depth varies between systems, yes, you may need to capture the graphic on each target system.
For examples see:
http://www.mjtnet.com/imagerecognition.htm
Second, there's no need to use the entire screen. I would simply capture the area of the status bar that signifies process completion - or whatever part of the screen tells me the process is complete. This can then be used regardless of window size or placemenet and regardless of screen dimensions. But if the color depth varies between systems, yes, you may need to capture the graphic on each target system.
For examples see:
http://www.mjtnet.com/imagerecognition.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?