Jump to content

Recommended Posts

Posted (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 by Borje
Posted

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?

 

 

Posted

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:

  1. The text document is in the same folder with your au3
  2. Use --> FileGetTime("test1.txt",1) -- instead of script directory
  3. Write the full path to your file

TY.

Posted

Hi taylansan

 

I have now test your example an all works problem was that you told me t is not an array

Thanks again

 

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...