I'm having trouble testing if two string variables match. Below is my code (sorry I know know how to embed this correctly)
// Testing String Matching
Let>IGNORESPACES=1
Let>VAREXPLICIT=1
Let>str_One=A
Let>str_Two=B
If str_One=str_Two
MessageModal>Method One Match
Else
MessageModel>No match with method one
EndIf
Let>str_One={"A"}
Let>str_Two={"B"}
If %str_One%=%str_Two%
MessageModal>Match Two Match
Else
MessageModel>No match with method two
EndIf
String Matching
Moderators: Dorian (MJT support), JRL
String Matching
MS v15 | Windows 11 Pro | NY, USA
Re: String Matching
Hi,
If --> if>
MessageModel --> MessageModal
If --> if>
MessageModel --> MessageModal
Code: Select all
Let>IGNORESPACES=1
Let>VAREXPLICIT=1
Let>str_One=A
Let>str_Two=B
If>str_One=str_Two
MessageModal>Method One Match
Else
MessageModal>No match with method one
EndIf
Let>str_One={"A"}
Let>str_Two={"B"}
If>str_One=str_Two
MessageModal>Match Two Match
Else
MessageModal>No match with method two
EndIf
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: String Matching
Two issues :
1. You forgot the chevron after If. So :
2. You had MessageModel twice instead of MessageModal
To display code select your text and then click the fifth button along in the editor. the one that looks like this : </>
1. You forgot the chevron after If. So :
Code: Select all
If>
Code: Select all
Let>IGNORESPACES=1
Let>VAREXPLICIT=1
Let>str_One=A
Let>str_Two=B
If>str_One=str_Two
MessageModal>Method One Match
Else
MessageModal>No match with method one
EndIf
Let>str_One={"A"}
Let>str_Two={"B"}
If>%str_One%=%str_Two%
MessageModal>Match Two Match
Else
MessageModal>No match with method two
EndIf
Yes, we have a Custom Scripting Service. Message me or go here
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: String Matching
Snap! Two for the price of one.hagchr wrote: ↑Mon May 15, 2023 7:00 pmHi,
If --> if>
MessageModel --> MessageModal
Code: Select all
Let>IGNORESPACES=1 Let>VAREXPLICIT=1 Let>str_One=A Let>str_Two=B If>str_One=str_Two MessageModal>Method One Match Else MessageModal>No match with method one EndIf Let>str_One={"A"} Let>str_Two={"B"} If>str_One=str_Two MessageModal>Match Two Match Else MessageModal>No match with method two EndIf
Yes, we have a Custom Scripting Service. Message me or go here
Re: String Matching
Thank you everyone who kindly replied. You have no idea how long I stared at that small bit of code and didn't see the typos. I'm sure it would a huge undertaking to add syntax checking to the editor but, I miss that feature.
MS v15 | Windows 11 Pro | NY, USA
- Dorian (MJT support)
- Automation Wizard
- Posts: 1389
- Joined: Sun Nov 03, 2002 3:19 am
- Contact:
Re: String Matching
If your command doesn't change colour, it's not been recognized. You should also see a little syntax helper at the bottom of the window. If you don't see that and/or it does not progress as you add parameters, then the command has not been recognized. Also once you type the first 3 letters of a command, it will make suggestions. Down arrow and enter will complete that for you.
Yes, we have a Custom Scripting Service. Message me or go here