Jump to content

Stringgetpos Problem.....


Recommended Posts

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:

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:

Link to post
Share on other sites
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...