Search the Community
Showing results for tags 'chars'.
-
#include <WinAPI.au3> $text = FileReadLastChars("C:\Program Files\AutoIt3\Include\Array.au3", 1024) MsgBox(0, 'FileReadLastChars', $text) Func FileReadLastChars($sFile, $nChars) Local $nBytes $tBuffer = DLLStructCreate("char["&$nChars&"]") $hFile = _WinAPI_CreateFile($sFile, 2, 2) ; open for read _WinAPI_SetFilePointer($hFile, -1 * $nChars, 2) ; from end _WinAPI_ReadFile($hFile, DLLStructGetPtr($tBuffer), $nChars, $nBytes) _WinAPI_CloseHandle($hFile) Return DLLStructGetData($tBuffer, 1) EndFunc ; included as standard UDF since AutoIt 3.2.13.6 version Func _WinAPI_SetFilePointer($hFile, $iPos, $iMethod = 0) $aResult = DllCall( "kernel32.dll", "long", "SetFilePointer", "hwnd", $hFile, "long", $iPos, "long_ptr", 0, "long", $iMethod) If @error Then Return SetError(1, 0, -1) If $aResult[0] = -1 Then Return SetError(2, 0, -1) ; $INVALID_SET_FILE_POINTER = -1 Return $aResult[0] EndFunc ;==>_WinAPI_SetFilePointer Here is my topic about _WinAPI_SetFilePointer() EDIT: simpler version compatible with latest AutoIt $text = FileReadLastChars("C:\Program Files\AutoIt3\Include\Array.au3", 1024) MsgBox(0, 'FileReadLastChars', $text) Func FileReadLastChars($sFile , $nChars) $hFile = FileOpen($sFile, 0) ; open for read FileSetPos($hFile, -1 * $nChars, 2) ; from end $sRet = FileRead($hFile) FileClose($hFile) Return $sRet EndFunc
-
Hi all.. i need to make a new line, i googled it and it said to use... `n .... for a new line.. however im getting an illegal character error on au3.. so how does one write the NEW LINE escape character?
- 14 replies
-
- escape characters
- escape
-
(and 2 more)
Tagged with:
-
Hi, i wanted to make inputbox password, need to get it's chars length in it, because the "password char" is too secure and i need the user to know if he is writing or not!! here's my effort Global $length, $Pw $Pw = InputBox("Security", "Type password to Encrypt/Decrypt file." & @CRLF & "Notice: password case sensitive" & @CRLF & "Pw length: " & $length, "", "ٌ", 220, 150) $length = StringLen($Pw) MsgBox(0, "", $length) i tried to put $length above $Pw but didn't work too. thanks