eyegeegeewhy Posted October 15, 2007 Share Posted October 15, 2007 Im trying to add a function to my script that checks for missing files each file is called something like XXXXXX_XXXXXXXX_0001 then XXXXXX_XXXXXXXX_0002, XXXXXX_XXXXXXXX_0003 XXXXXX_XXXXXXXX_0004 and so on and so on. The GUI on my app sets the first and last number, so what I have so far is Func LIST_MISSING_FILES() For $i = $START_PAGE To $END_PAGE If FileExists("C:\temp\sample_data\"&$BOOK&"_classified_"&$i) Then $somethingpointless=1 Else MsgBox(4096,"", $BOOK&"_classified_"&$i& " does not exist") EndIf Next EndFunc The problem is even if in the GUI you set the $START_PAGE to be 0001 $i becomes just 1 and the file exists fail I hope this makes sense to someone. Link to comment Share on other sites More sharing options...
weaponx Posted October 15, 2007 Share Posted October 15, 2007 (edited) Are they all 4 digit numbers? EDIT: Dammit Smoke. You knew where I was going with that one. Edited October 15, 2007 by weaponx Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 15, 2007 Moderators Share Posted October 15, 2007 $Book = 1 $BookReLoaded = StringFormat("%04d", $Book) MsgBox(0,0,$BookReLoaded) Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Nahuel Posted October 15, 2007 Share Posted October 15, 2007 (edited) Maybe you could do something like this: Func LIST_MISSING_FILES() For $i = $START_PAGE To $END_PAGE If FileExists("C:\temp\sample_data\"&$BOOK&"_classified_000"&$i) Then $somethingpointless=1 Else MsgBox(4096,"", $BOOK&"_classified_"&$i& " does not exist") EndIf Next EndFunc But it will only work up to 9. The trick is to make the "000X" a string, not a number. -edit- Beaten by Smoke with a cooler and more efficient method. Edited October 15, 2007 by Nahuel Link to comment Share on other sites More sharing options...
eyegeegeewhy Posted October 15, 2007 Author Share Posted October 15, 2007 i glanced at the StringFormat page in the help file but it made my head hurt so I stopped. Thanks for pointing in the right direction I will give it a read again. Cheers again for the v quick responce Link to comment Share on other sites More sharing options...
Tlem Posted October 16, 2007 Share Posted October 16, 2007 SmOke_N give you the solution : Func LIST_MISSING_FILES() For $i = $START_PAGE To $END_PAGE $Page = StringFormat("%04d", $i) If FileExists("C:\temp\sample_data\"&$BOOK&"_classified_"&$Page) Then $somethingpointless=1 Else MsgBox(4096,"", $BOOK&"_classified_"&$Page& " does not exist") EndIf Next EndFunc Best Regards.Thierry Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now