

If you want to perform certain actions only if certain window
exist or does not exist then you can use conditional If-Endif
commands.
How to wait for a condition
to be true?
-
Let's say you want to perform some action only if a
window exists. You know it might take anytime between 5 seconds to 5 minutes
for that window to come
up.
-
Obviously, you would not like to wait for 5 minutes
if the window comes up in 30
seconds.
-
Workspace Macro Pro takes care of this for
you.
-
In the textbox in the If command, specify the maximum
time (in seconds) up to which you like to wait for the window to appear. In
this case 5 minutes i.e. 300
seconds.
-
Workspace Macro Pro will keep on checking for the window up to 300 seconds
and as soon as the window appears, will execute actions
within the conditional commands. So in this case, it will wait only 30 seconds and
then performs the
actions.
-
If you leave the textbox empty or provide 0
then Workspace Macro Pro checks the condition right away and if it is met it
will execute the actions otherwise it will skip those actions and proceed to
actions after
Endif.
Example 1:To close notepad window if
open.
-
Open the Macro Editor from Tools -> Macro Editor.
-
Double click on the 'If'
command.
-
Select the option 'Window
exists'.
-
Make sure that 'Untitled - Notepad' is already open.
-
Click on the 'Refresh' button.
-
Select the title 'Untitled - Notepad' from the list.
-
Click on 'Save' button.
-
Insert the 'Close Window' command in between 'If - End if' statements.
Example 2:Search for a record, if found perform different
actions
Often you want to perform a search for an item, a word or
a record in your application. If found you want to perform some actions, and if
not, perform some other actions.
-
Search for a item, a word or a record that doesn't
exist so that you see a
window that says 'Not
Found'.
-
Open the
Macro
Editor from Tools -> Macro
Editor.
-
Double click on the 'If'
command.
-
Select the option 'Window
exists'.
-
Select the Not Found window title from the list.
-
Click on 'Save' button.
-
Insert the actions you want to perform between 'If - End if' statements.