Jump to content
Macro Express Forums

Search for a Value


Recommended Posts

I need help doing the following. I know it will need an if statement, I'm just not sure how to do it exactly.

 

When searching for a value, using the find command, 1 of 2 things can happen:

 

1. If value is not found program will open a window with the name UltraEdit.

2. If the value is found, I want to highlight the word(s) by doing a Shift End and copying it to a variable.

 

When running the macro without stopping, how do we know which value has been found?

 

Thanks for any help.

 

Bob

Link to comment
Share on other sites

// Method 1 - Use a variable to capture the window title
Variable Set String %WindowTitle% to topmost window title
// Test if the focused window title contains the words "UltraEdit"
If Variable %WindowTitle% Contains "UltraEdit"
// Value not found. Do something.
Else
// Value is found. Select to end of line.
 Text Type (Simulate Keystrokes): <SHIFT><END>
End If

// Method 2 - Use the "If Window" command
If Window "UltraEdit" is focused
// Value not found. Do something.
Else
// Value is found. Select to end of line.
 Text Type (Simulate Keystrokes): <SHIFT><END>
End If

Link to comment
Share on other sites

I’m not sure but it sounds like you're opening a text file in anapplication and using the find command to see if something exists. A betterapproach would be to load the file contents into a text variable and using theMEP command “If” with the option “Contains”.

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...