I've encountered a problem with a single file where I cannot retrieve it's Date-time. So far my code has worked well for over 30 files, but this one is a mystery I cannot debug myself due to insufficient Au3 knowledge.
In line 11 "_Date_Time_FileTimeToArray" is called and for this particular file it sets the @error to 10. I don't know what that error code means, but it's not set by the _Date functions themselves I think.
Overall, it could be a problem caused by any of the functions below, how can I properly debug this? / Does anybody know a what's causing this?
_WinAPI_CreateFile() / _Date_Time_GetFileTime() / _Date_Time_FileTimeToArray()
Func _SetFileTimes($sFilePath) Local $monthNumber = ["", "January", "February", "March", "April", "May", "Juny", "July", "August", "September", "October", "November", "December"] Local $dayNumber = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"] Local $fHandle = _WinAPI_CreateFile($sFilePath, 2, 2) ; read-only ; may NOT return a valid date for some reason! TODO Local $fTagFILETIME = _Date_Time_GetFileTime($fHandle) _WinAPI_CloseHandle($fHandle) ; This will return an empty array if theres no valid date $fModTime = _Date_Time_FileTimeToArray($fTagFILETIME) ; last Modified if @error <> 10 then Local $year = $fModTime Local $month = $fModTime Local $day = $fModTime Local $hour = $fModTime Local $min = $fModTime Local $sec = $fModTime Local $ms = $fModTime Local $weekday = $fModTime Global $prettyTimestamp = StringFormat("%s, %s %d, %04d %02d:%02d:%02d", $dayNumber[$weekday], $monthNumber[$month], $day, $year, $hour, $min, $sec) Global $uploadDate = StringFormat("%04d-%02d-%02d", $year, $month, $day) $fModTime = _Date_Time_FileTimeToArray(_Date_Time_FileTimeToLocalFileTime($fTagFILETIME)) ; last Modified Local $year = $fModTime Local $month = $fModTime Local $day = $fModTime Local $hour = $fModTime Local $min = $fModTime Local $sec = $fModTime Local $ms = $fModTime Local $weekday = $fModTime ; GetUnixTime accounts for Local time, hence feed it local time Global $unixTimestamp = _GetUnixTime($year &"/"& $month &"/"& $day &" "& $hour&":"& $min &":"& $sec) else Global $prettyTimestamp = "N/A" Global $uploadDate = "" Global $unixTimestamp = "N/A" endif endfunc
_GetUnixTime returned the year 1601 start date, showing that $fModTime is probably equal 0. (But Why?)
The file reports these dates in Explorer, it's on local NTFS drive:
Created: Wednesday, 31. Januar 2018, 18:55:02
Modified: Wednesday, 10. Januar 2018, 12:39:23
Accessed: Wednesday, 10. Januar 2018, 12:39:23
I am sure you guys know of a simple solution but I am still kind of new to AutoIt and its special functions. I want my code to be able to know how to encrypt and decrypt "A" and "a" as two different chars.
my code is very long so here is just a snippet/example of it.
;Encode== Global $charAA = "" ; ( Capital letter A ) = Global 184 = ¸ ( Cedilla ) $charAA = $charAA & Chr(65) Global $chara = "" ; ( Lowercase letter a ) = Global 251 = û ( û Latin Small Letter U With Circumflex ) $chara = $chara & Chr(97) ;Decode== Global $ch184 = "" ;( Copyright symbol ) = $charAA $ch184 = $ch184 & Chr(184) Global $ch251 = "" ;( û Latin Small Letter U With Circumflex ) = $chara $ch251 = $ch251 & Chr(251) ;Encode== stringreplace($test_String, $charAA, $ch184) stringreplace($test_String, $chara, $ch251) ;Decode== stringreplace($$new_String, $ch184, $charAA) stringreplace($$new_String, $ch251, $chara) ( NOTE: my stringreplace function is nested in my actual code. I only separated them here for readability. )
I know there are better ways to Encrypt and Decrypt a message but I'm doing this as a fun side project for me and a select group of friends to enjoy.
Again My code is not encrypting or decrypting capitals and lower case properly even though I use their ANSI codes.
Example: Input "A a B b" Encrypt: ". . $ $" Decrypt: "A A B B"
Any and all help will be greatly appreciated.
I'm listing the error message strings, and roughly matching the error code
Is this how to do error reporting? Is there a more simple way I don't know about?
I realise I might not need to trap @error inside $error. I like it this way b/c I have no fear of overwriting @error now; I don't even use it.
Func Send_Connect($address, $port) $socket = TCPConnect($address, $port) $error = @error If $error <> 0 Then Local $aError = ["-2 not connected.", _ "1 IPAddr is incorrect.", _ "2 port is incorrect."] $aError = "10060 Connection timed out." If $error < 0 Then $error = 0 If $error > 2 Then $error = 3 MsgBox(0, "TCP Connect Error", $aError[$error], 0) $socket = 0 EndIf Return $socket EndFunc
Hello i have a text file which contain over 600KB of BASE64 strings like :
Now what i need is divide this long string as autoit variable each max lenght (4000characters per line) example:
$var &= TVqQAAMAAAAEAAA..
$var &= VbAmejwqqqAACEE..
and then how to i add encrypt function on every line ? how to i can xor it? example final will be :
$var &= XorEnc(TVqQAAMAAAAEAAA..)
$var &= XorEncVbAmejwqqqAACEE..)
Thanks for any help and ideas