Custom Query
Results (145 - 147 of 3870)
Ticket | Resolution | Summary | Owner | Reporter |
---|---|---|---|---|
#503 | Fixed | _Date_Time_FileTimeToLocalFileTime() - Helpfile example is incorrect | Gary | cbruce |
Description |
The helpfile example uses _Date_Time_EncodeFileTime() to create an initial value to work with. The problem is that this creates a LOCAL time value and not a UTC time value. Since FileTimes are stored as UTC time, when _Date_Time_FileTimeToLocalFileTime() is passed a LOCAL time value, it applies the UTC to LOCAL conversion and the returned value is not what was intended. Here's the example with corrections: * #include <GuiConstantsEx.au3> #include <Date.au3> #include <WindowsConstants.au3> Global $iMemo _Main() Func _Main() ; --------------- FROM --------------- ;Local $hGUI, $tFile, $tLocal ; --------------- TO --------------- Local $hGUI, $tSystem, $tFile, $tLocal ; -------------------------------------- ; Create GUI $hGUI = GUICreate("Time", 400, 300) $iMemo = GUICtrlCreateEdit("", 2, 2, 396, 296, $WS_VSCROLL) GUICtrlSetFont($iMemo, 9, 400, 0, "Courier New") GUISetState() ; --------------- FROM --------------- ;; Encode a file time ;$tFile = _Date_Time_EncodeFileTime(@MON, @MDAY, @YEAR, @HOUR, @MIN, @SEC) ; --------------- TO --------------- ; Get system time $tSystem = _Date_Time_GetSystemTime() $tFile = _Date_Time_SystemTimeToFileTime(DllStructGetPtr($tSystem)) ; -------------------------------------- $tLocal = _Date_Time_FileTimeToLocalFileTime(DllStructGetPtr($tFile)) MemoWrite("Local file time .: " & _Date_Time_FileTimeToStr($tLocal)) ; Loop until user exits Do Until GUIGetMsg() = $GUI_EVENT_CLOSE EndFunc ;==>_Main ; Write a line to the memo control Func MemoWrite($sMessage) GUICtrlSetData($iMemo, $sMessage & @CRLF, 1) EndFunc ;==>MemoWrite * Thank you all for your time and effort. Respectfully, Bruce Huber |
|||
#504 | Fixed | "au3check" doesn't handle special characters properly | Jos | ptrex |
Description |
When storing an include file, in a folder wich contains special characters, like this : c:\temp\UDF's "au3check" doesn't handle special characters properly in SciTE. #Include "c:\temp\UDF's\TEST.au3" It will only accept :-> #Include "c:\temp\UDF\TEST.au3" |
|||
#506 | Fixed | _FileCountLines | Gary | Xenobiologist |
Description |
Same problem as I mentioned before with _FileReadToArray. The function _FileCountLines should deal all common line-end-chars. LF, CR, CRLF. I changed it to this: ; #FUNCTION# ==================================================================================================================== ; Name...........: _FileCountLines ; Description ...: Returns the number of lines in the specified file. ; Syntax.........: _FileCountLines($sFilePath) ; Parameters ....: $sFilePath - Path and filename of the file to be read ; Return values .: Success - Returns number of lines in the file. ; Failure - Returns a 0 ; @Error - 0 = No error. ; |1 = File cannot be opened or found. ; |2 = Unable to Split the file ; Author ........: Tylo <tylo at start dot no> ; Modified.......: Xenobiologist ; Remarks .......: It does not count a final @LF as a line. ; Related .......: ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func __FileCountLines($sFilePath) Local $hFile, $sFileContent, $aTmp $hFile = FileOpen($sFilePath, 0) If $hFile = -1 Then Return SetError(1, 0, 0) $sFileContent = StringStripWS(FileRead($hFile, FileGetSize($sFilePath)), 2) FileClose($hFile) If StringInStr($sFileContent, @LF) Then $aTmp = StringSplit(StringStripCR($sFileContent), @LF) ElseIf StringInStr($sFileContent, @CR) Then $aTmp = StringSplit($sFileContent, @CR) Else Return SetError(2, 0, 0) EndIf Return $aTmp[0] EndFunc ;==>__FileCountLines |