q4q Posted January 18, 2004 Posted January 18, 2004 The following script works OK if the $file is 'test3.au3' but fails if it is 'test33.au3' or longer. It appears as though '*' is behaving like '?'. Can someone help with this or is it a bug? $file = FileFindFirstFile("C:\temp\Test*.au3") $tmp = FileGetTime($file) $time = "" For $i = 0 to 5 $time = $time&$tmp[$i] Next MsgBox(0, "test", $file&@CRLF&$time) Failure message: Line 5 (File "I:\Apps\AutoIt3\Scripts\Test3.au3"): $time = $time&$tmp[$i] $time = $time&$tmp^ ERROR Error: Subscript used with non-Array variable.
scriptkitty Posted January 19, 2004 Posted January 19, 2004 I just tested this, and it worked fine for version 3.0.85.0 It found test3.au3,test33.au3,test33333333.au3, I couldn't reproduce your bug. AutoIt3, the MACGYVER Pocket Knife for computers.
CyberSlug Posted January 19, 2004 Posted January 19, 2004 (edited) Works for me on later betas (3.0.86 and 3.0.87) Note to self: document wildcards Edited January 19, 2004 by CyberSlug Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
q4q Posted January 19, 2004 Author Posted January 19, 2004 Did you try running the script from a different location to the $file? I've now noticed I can run it without error if the compiled script in the same directory as the $file but as soon as I move the script to another folder or drive it fails. I've now tried 4 computers with W95, W2k & WXpPro and also v3.0.85 and still get the error, maybe it's Novell the only common feature.
scriptkitty Posted January 19, 2004 Posted January 19, 2004 Ok, I retested the script in several locations. It is bad programing actually, or sloppy. Note I didn't see it at first as well. Try this: $file = FileFindFirstFile("C:\temp\Test*.au3") $tmp = FileGetTime("C:\temp\"& $file) $time = "" For $i = 0 to 5 $time = $time&$tmp[$i] Next MsgBox(0, "test", $file&@CRLF&$time) FileFindFirstFile(path\filename) only returns the filename, not the path, hence the problem. AutoIt3, the MACGYVER Pocket Knife for computers.
q4q Posted January 19, 2004 Author Posted January 19, 2004 OK, so obvious once pointed out. Many thanks.
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