stev379 Posted May 29, 2008 Share Posted May 29, 2008 (edited) Hi, In testing as an .au3 file it succeeds, but once compiled it fails with "Subscript used with non-array variable". Any idea why? $SofieDir = (@ProgramFilesDir & "\Sofie") $SofieAddIn = ("SofieAddIn.xla") If Not FileExists($SofieDir) Then DirCreate($SofieDir) If FileExists($SofieDir & "\" & $SofieAddIn) Then $t = FileGetTime($SofieAddIn) $mdyyyy = $t[1] & "/" & $t[2] & "/" & $t[0] If $mdyyyy = "3/5/2008" Then Exit Else FileInstall("SofieAddIn.xla", $SofieDir & "\" & $SofieAddIn, 1) EndIf Else FileInstall("SofieAddIn.xla", $SofieDir & "\" & $SofieAddIn, 1) EndIf Thanks!! Edited May 29, 2008 by stev379 Link to comment Share on other sites More sharing options...
Paulie Posted May 29, 2008 Share Posted May 29, 2008 Perhaps your FileGetTime() function that is defining the array is failing. (i.e. couldn't find the file) A simple test would be to do this: $SofieDir = (@ProgramFilesDir & "\Sofie") $SofieAddIn = ("SofieAddIn.xla") If Not FileExists($SofieDir) Then DirCreate($SofieDir) If FileExists($SofieDir & "\" & $SofieAddIn) Then $t = FileGetTime($SofieAddIn) If @error then Msgbox(0,"Error", "An error occured.") $mdyyyy = $t[1] & "/" & $t[2] & "/" & $t[0] If $mdyyyy = "3/5/2008" Then Exit Else FileInstall("SofieAddIn.xla", $SofieDir & "\" & $SofieAddIn, 1) EndIf Else FileInstall("SofieAddIn.xla", $SofieDir & "\" & $SofieAddIn, 1) EndIf If I had to guess why it would fail, i would say try changing the FileGetTime() parameter to be a full path to the file, because otherwise, it only references @scriptdir so try this too: $t = FileGetTime($SofieDir & "\" & $SofieAddIn) Link to comment Share on other sites More sharing options...
stev379 Posted May 30, 2008 Author Share Posted May 30, 2008 Perhaps your FileGetTime() function that is defining the array is failing. (i.e. couldn't find the file) If I had to guess why it would fail, i would say try changing the FileGetTime() parameter to be a full path to the file, because otherwise, it only references @scriptdir so try this too: $t = FileGetTime($SofieDir & "\" & $SofieAddIn) AWESOME! Once again the AutoIT forum saves the day! Thanks!! 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