Using wildcards in If statements

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
ck369
Newbie
Posts: 3
Joined: Tue Oct 29, 2013 3:00 pm

Using wildcards in If statements

Post by ck369 » Tue Jan 28, 2014 2:36 pm

I want to be able to open a text file, pull the text from the file then search to see if a specific word or phrase is used in the file. I am sure that I am making a simple mistake here and any help would be greatly appreciated.

Thanks!

GetWindowText>TEXT VERSION OF POSTAGE STATEMENT.TXT - Notepad,strText
wait>.25
if>%strText% = *Standard*
message>this is standard
else
message>this is not Standard
endif

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

Post by Marcus Tettmar » Tue Jan 28, 2014 2:38 pm

You can't use wildcards in IF statements. Instead you can use the Position command or RegEx:

Code: Select all

GetWindowText>TEXT VERSION OF POSTAGE STATEMENT.TXT - Notepad,strText 
Pos>Standard,strText,1,posStandard
If>posStandard>0
  MessageModal>this is standard
Else
  MessageModal>not standard
Endif
Pos returns the position of a substring in another string. So if the result is zero there is no match, if positive the substring exists in the string.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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