Borje Posted March 22, 2017 Share Posted March 22, 2017 (edited) Hi everybody !! ;Please if anybody could help me whit this!! ;What is wrong with this code ? ;What i want is filegetTime from test1.txt and test2.txt then compare this and if it differnts Then ;fileset time on both files in the code below. ;IF $fil1 = $fil2 Then ; ok() ; notok() ;EndIf ;Down here is my little code #include <file.au3> #include <array.au3> $drive = "c:" If Not @error Then $t = FileGetTime(@ScriptDir & "\test1.txt",1) ; [1 = Created] , 2 = Used $fil1 = $t[0] & "-" & $t[1] & "-" & $t[2] endif $u = FileGetTime(@ScriptDir & "\test2.txt",1) ; [1 = created] , 2 = Använd $fil2 = $u[0] & "-" & $u[1] & "-" & $u[2] MsgBox(0, "Files ",$fil1 & " "& $fil2) $var1 = FileSetTime(@ScriptDir & "\test1.txt", "20171010",1) ; [1 = Created] , 2 = Used $var2 = FileSetTime(@ScriptDir & "\test2.txt", "20171010",1) Exit ; Down here is my error message ;$fil1 = $t[0] & "-" & $t[1] & "-" & $t[2] ;$fil1 = $t^ ERROR ;>Exit code: 1 Time: 0.329 Edited March 23, 2017 by Borje Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 22, 2017 Moderators Share Posted March 22, 2017 @Borje in the future please put your code in code tags <>, makes it much easier to read "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Borje Posted March 22, 2017 Author Share Posted March 22, 2017 Just now, JLogan3o13 said: @Borje in the future please put your code in code tags <>, makes it much easier to read Ok how i do that ? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted March 22, 2017 Moderators Share Posted March 22, 2017 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Borje Posted March 22, 2017 Author Share Posted March 22, 2017 I have a another Question if i use fileinstall to example @Scriptdir and after that try to change the creation date on the file with FileSetTime that would not works to give the new date but if I run from editor not compiled that works but when i compiled that not works why? perhaps there is a solution of this problem? Link to comment Share on other sites More sharing options...
taylansan Posted March 22, 2017 Share Posted March 22, 2017 That is because your variable "t" is not an array. In other words, you couldn't get the creation time of "test1.txt". Make sure that: The text document is in the same folder with your au3 Use --> FileGetTime("test1.txt",1) -- instead of script directory Write the full path to your file TY. Link to comment Share on other sites More sharing options...
Borje Posted March 23, 2017 Author Share Posted March 23, 2017 Thanks taylansan I should test this and see if that works. Link to comment Share on other sites More sharing options...
Borje Posted March 23, 2017 Author Share Posted March 23, 2017 Hi taylansan I have now test your example an all works problem was that you told me t is not an array Thanks again 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