Search the Community
Showing results for tags 'last'.
Found 4 results
Hi all I want a way to get the last key pressed. I have a program that works with keyboard shortcuts and I want to give the permission for the user to edit shortcut keys depending on what suits him i want to make read-only edit box and the program writes the latest shortcut key pressed Please help me, greetings to all And thanks in advance
#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 22.214.171.124 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 = -1 Then Return SetError(2, 0, -1) ; $INVALID_SET_FILE_POINTER = -1 Return $aResult 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
I searched around for the best way to this and am still a bit lost. I am trying to find the last non-empty cell in a column in Excel. In the past, there was a function _ExcelSheetUsedRangeGet($oExcel, $vSheet) in >this thread. However, much has changed since then and when I downloaded it I could not find that function to see how it worked. Google found this site for me which offered a couple of promising looking approaches: They are in VBA. I usually can convert VBA but I am not 100% on these. The first approach looks a lot like it should convert easily to _Excel_RangeFind but I am not familiar enough with all the parameters. I understand the operators referenced in the help file but I did not see a lot of info on XLFindLookIn and not sure what to do with .Row. I am also not sure if these are the best approaches? Any guidance on the best way to do this would be much appreciated. If this is already part of _Excel_RangeFind I could use an example. Any help would be greatly appreciated. JFish
I tried a lot of techniques but still have no luck.. How can I delete the second sentence until the last sentence of a set paragraph range on a Microsoft Word document? #include <Word.au3> Global $oWord, $oDoc $oWord = _Word_Create() $oDoc = _Word_DocGet($oWord, 1) Global Const $Count = $oDoc.Paragraphs.Count For $i = 0 To $Count - 1 $oRange = _Word_DocRangeSet($oDoc, -1, $wdParagraph, $i, $wdParagraph, 1) ; Here will be placed the missing code Next Sample of the beginning of a Word document: This is a sentence 1. This is a sentence 2. This is a sentence 3. This is a sentence 4. This is a sentence 5. This is a sentence 6. This is a sentence 7. This is a sentence 8. This is a sentence 9. Sample of the final result: This is a sentence 1. This is a sentence 4. This is a sentence 7.