Hi.
I want to make a formula that does this:
If string contains "this text" then do this.
This is my line atm.
If>DesiredChange=Inside dim
I'm basically looking for something to replace the "=" so it isn't 100% equal. I just want to know if the text appears in the string.
I tried using the * that works on things like window titles, but it doesn't seem to work here
Will regex be necessary?
Thanks in advance!
if>string contains
Moderators: Dorian (MJT support), JRL
- Dorian (MJT support)
- Automation Wizard
- Posts: 1348
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: if>string contains
Does something like the script below do what you need? It takes a string, in this case FishCatDog, and looks for Cat. If it finds Cat, it changes it to Horse. If it doesn't, nothing is changed.
Code: Select all
Let>MyString=FishCatDog
Pos>Cat,MyString,1,PosCat,
If>PosCat>1
StringReplace>MyString,Cat,Horse,MyString
Endif
MessageModal>MyString
Yes, we have a Custom Scripting Service. Message me or go here
Re: if>string contains
@Scones,
Does this work for you?
Do you not like RegEx? You can skin a cat, including this one, in many ways.
Good Luck,
PepsiHog
Does this work for you?
Code: Select all
let>MyText=That darn cat keeps barking all night long.
let>FindThis=cat
RegEx>FindThis,MyText,0,match,nom,0
if>nom>0
RegEx>FindThis,MyText,0,match,nom,1,dog,res
endif
mdl>%res%
Good Luck,
PepsiHog
Windows 7
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!
PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2021) AND enjoy programming. (That's my little piece of heaven!)
The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!