Using If> with the Pos function

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
criddle
Newbie
Posts: 4
Joined: Thu Mar 10, 2005 10:26 pm
Location: Toronto

Using If> with the Pos function

Post by criddle » Fri Mar 25, 2005 8:31 pm

I know I could do the "if" line using two lines, but I am curious why this does not work. I have tried a few variations of the curly brackets and round brackets, but none seem to work.

Let>filename=C:\test.txt
If>{(Pos("\",%filename%)>0)}
Let>note=filename has slashes
Else
Let>note=filename does not have slashes
EndIf
Message>%note%

Is it that the Pos function only works after a relational operator?

Me_again
Automation Wizard
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Post by Me_again » Fri Mar 25, 2005 10:17 pm

Pos isn't listed as a string function that works with If> so I don't think there is any reasonable expectation that it should work.

User avatar
criddle
Newbie
Posts: 4
Joined: Thu Mar 10, 2005 10:26 pm
Location: Toronto

Post by criddle » Fri Mar 25, 2005 10:22 pm

You Again :wink:

Thanks

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Fri Mar 25, 2005 11:31 pm

Do it like this:

Let>filename=C:\test.txt
Let>p={Pos("\",%filename%)}
If>p>0
Let>note=filename has slashes
Else
Let>note=filename does not have slashes
EndIf
Message>%note%
MJT Net Support
[email protected]

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