Sign in to follow this  
Followers 0
jchambers4

Stringgetpos Problem.....

3 posts in this topic

I have written the following test to attempt to isolate the FILENAME from a drive, directories, and filename combined string. My code is as follows:

SETENV,TEST,C:\\JACK\\WAS\\HERE\\JACK.XLS

NotJustFile:

MsgBox,0,Test,%Test%

StringGetPos,FoundIt,Test,\\

MsgBox,0,FoundIt,%FoundIt%

IfEqual,FoundIt,1,Goto,HaveJustFile

ENVADD,FoundIt,1

StringTrimLeft,NewTest,Test,%FoundIt%

SETENV,Test,%NewTest%

MsgBox, 0,Test,%Test%

Goto,NotJustFile

HaveJustFile:

MsgBox, 0,Done,%Test%

However, after it isolates "JACK.XLS" it does not terminate as I would expect. With StringGetPost returning a 1 because it did not find the string and my program exiting with the string I need. Instead it returns a 5 and continues into a endless loop.

Do anyone have any suggestions on what is going on here?

Thanks in advance, :whistle:

Share this post


Link to post
Share on other sites



Larry,

Thanks for the solution(workaround).

However, it does not explain why the original code does not work when according to the specification(documentation) it should.

Thanks again, I will use the code you provided to continue on my way.

Share this post


Link to post
Share on other sites

Larry, Thanks....

I understand that AutoIt in this case counts like a computer starting at 0.

But this does not explain the problem at hand.

The routine does not return the correct value at all.

It point to the middle of the string were this is clearly no "\".

Let me know what you think.

Thanks for your help. :whistle:

Share this post


Link to post
Share on other sites
Sign in to follow this  
Followers 0