Having trouble with ;function Pos(Substr: string; S: string): Integer
Could you please show an example which displays a message of the integer result.
Thank You
function Pos(Substr: string; S: string): Integer
Moderators: Dorian (MJT support), JRL
- Marcus Tettmar
- Site Admin
- Posts: 7391
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Here you go:
Let>p={pos("world","hello world")}
MessageModal>p
Let>p={pos("world","hello world")}
MessageModal>p
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
This is the code I had written
The line of text i was testing reads 374
Let>L=7
ReadLn>c:\Documents and Settings\User\Desktop\mousemove3.txt,L,line
Let>textstring=line
Message>%textstring%
Wait>3
Let>TestForX={Pos("",%textstring%)}
IF>TestForX>0
Message>yes
ELSE
Message>no
ENDIF
I used an example in help as a guide my message shows the teststring
but after the if my message result is always no, even if I test for "3"
The line of text i was testing reads 374
Let>L=7
ReadLn>c:\Documents and Settings\User\Desktop\mousemove3.txt,L,line
Let>textstring=line
Message>%textstring%
Wait>3
Let>TestForX={Pos("",%textstring%)}
IF>TestForX>0
Message>yes
ELSE
Message>no
ENDIF
I used an example in help as a guide my message shows the teststring
but after the if my message result is always no, even if I test for "3"
- Marcus Tettmar
- Site Admin
- Posts: 7391
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Hi,
Works for me:
Let>textstring=374
MessageModal>%textstring%
Let>TestForX={Pos("",%textstring%)}
IF>TestForX>0
MessageModal>yes
ELSE
MessageModal>no
ENDIF
The issue could just be that you are using the NON-modal message box, so it does not wait for you to press ok and a subsequent message will override it.
Try the above example anyway, and you'll see the Pos command is working fine.
Works for me:
Let>textstring=374
MessageModal>%textstring%
Let>TestForX={Pos("",%textstring%)}
IF>TestForX>0
MessageModal>yes
ELSE
MessageModal>no
ENDIF
The issue could just be that you are using the NON-modal message box, so it does not wait for you to press ok and a subsequent message will override it.
Try the above example anyway, and you'll see the Pos command is working fine.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Yes this code does work . For some reason my code with the IF and
ENDIF always produces a 'no' result.
I press the ok on the first message box which verifies for me that I
have the proper line and text from the file I read .
Then the second message box always came up 'no'.
I thought maybe there was a problem with the substring being .
Or with my IF statement.
Seems to be no cause for it.
Thank you
ENDIF always produces a 'no' result.
I press the ok on the first message box which verifies for me that I
have the proper line and text from the file I read .
Then the second message box always came up 'no'.
I thought maybe there was a problem with the substring being .
Or with my IF statement.
Seems to be no cause for it.
Thank you
- Marcus Tettmar
- Site Admin
- Posts: 7391
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Which version of Macro Scheduler are you running? Please check under Help/About.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?