Jump to content
Sign in to follow this  
q4q

FindFirstFile() - problem with wildcard*

Recommended Posts

q4q

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.

Share this post


Link to post
Share on other sites
scriptkitty

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.

Share this post


Link to post
Share on other sites
q4q

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.

Share this post


Link to post
Share on other sites
scriptkitty

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.