Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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.

Posted

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.

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...