jchambers4 Posted February 16, 2004 Share Posted February 16, 2004 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, Link to comment Share on other sites More sharing options...
jchambers4 Posted February 16, 2004 Author Share Posted February 16, 2004 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. Link to comment Share on other sites More sharing options...
jchambers4 Posted February 16, 2004 Author Share Posted February 16, 2004 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. Link to comment Share on other sites More sharing options...
Recommended Posts