Wait Cursor Ready

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
evangelmike
Pro Scripter
Posts: 56
Joined: Sun May 11, 2008 9:39 pm

Wait Cursor Ready

Post by evangelmike » Tue Jun 10, 2008 6:19 am

Greetings! When program control arrives at a certain pont in my macro, there are two possibilities:
1) The cursor may not be busy. In this case I wish to proceed with the rest of the processing immediately.
2) The cursor may be busy for up to 5 minutes.
If I use the WaitCursor Changed instruction to wait for the cursor to change with a 5 minute timeout, in the first case the macro will wait the full 5 minutes since the cursor is not busy, and therefore will never change.
In the second case, of course, the macro will wait for up to 5 minutes, waiting until the cursor changes from busy to nonbusy.
The problem is that a good 20% of the time, my macro is waiting for a cursor change which will never happen. I am trying to reduce run time from 4 hours down to about 3 1/2 hours. If up to 30 minutes is spent waiting for cursor changes which will never happen, this is very wasteful. Up to this point, I am unable to figure out a solution with the existing Macro Scheduler instruction set. A Wait Cursor Ready instruction, would be extremely useful, and would save up to about 30 minutes run-time each day, or about 3 hours a week!
May you have a blessed day!

Michael D Fitzpatrick
Reg. US Patent Agent

evangelmike
Pro Scripter
Posts: 56
Joined: Sun May 11, 2008 9:39 pm

WaitCursorChanged used after a file save

Post by evangelmike » Wed Jun 18, 2008 11:31 pm

When a Macro Scheduler macro is saving a large file, and you want to be sure that the file save has completed before allowing the macro to continue with its processing, one can use WaitCursorChanged to accomplish this as follows:

[code]
Let>SaveWait=10

SetFocus>(on the file to be saved)
WaitReady>
Wait>0.2
// Save the file via a CTRL-s; Note how the WaitCursorChanged
// instruction immediately follows the Send>s instruction
Press CTRL
Wait>0.2
Send>s
WaitCursorChanged>SaveWait
Wait>0.2
Release CTRL
Wait>0.2
MessageModal>SAVED!!!
[/code]

This sequence has been tested and timed numerous times without a failure.
May you have a blessed day!

Michael D Fitzpatrick
Reg. US Patent Agent

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Thu Jun 19, 2008 8:21 am

The success of this will depend on the application doing the saving. Not all apps change cursors in the same way.

There may also be other visual indications that the file is saving/has saved which can be detected using WaitScreenImage, or there may be some status bar text, for example, which can be monitored with the various text capture functions, or a button becomes enabled, or a window appears, or a pixel colour changes, etc etc ....

Every application works differently. As with any process you need to determine what signifies completion of a process and make the macro watch for that indication.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

evangelmike
Pro Scripter
Posts: 56
Joined: Sun May 11, 2008 9:39 pm

Use of WaitCursorChange to detect completion of File Save

Post by evangelmike » Thu Jun 19, 2008 10:35 pm

I spoke way too quickly. In the few programs I have checked so far, WaitCursorChanged can be used to detect completion of the save operation in Excel and WordPad, but not in NotePad or Microsoft Word 2007. For these two programs (and probably many others), other methods of determining completion of the save operation will have to be devised as needed.
May you have a blessed day!

Michael D Fitzpatrick
Reg. US Patent Agent

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts