Jump to content

AZJIO

Active Members
  • Posts

    1,703
  • Joined

  • Last visited

  • Days Won

    7

Everything posted by AZJIO

  1. CodeLocalizationAU3 Download: yandex, upload.ee Description: Localization of the AutoIt3 source code, translation of lines into the native language or vice versa. It was originally done for PureBasic, but by changing the character-by-character string analyzer a bit, it now works for AutoIt3. Supports command line for connecting to SciTE, Notepad++, AkelPad. Open the file via the command line or by dragging and dropping the file into the program window or using the "Open" button. Translate the lines that appear in the window on the left using QTranslate and paste the result into the right window. Check that each line has quotation marks at the beginning and at the end. Press the arrow button, the result will be in the clipboard. The "Reopen" button (red) is intended if the source code has been changed in the editor or if the line capture filter in the program settings has been changed. The "Re-read list" button (the check box button) is used if lines that should not be translated are deleted.
  2. Binary - use the second example. But I didn't take the 0x prefix into account when processing. This function cannot be applied simply by inserting it into the code, because it returns a pointer.
  3. WinGetClassList EnableExplicit Structure winparam hwnd.i title.s text.s result.s EndStructure Procedure EnumWinProc(hwnd.l, *ptr.winparam) Protected title${256} ; буфер GetWindowText_(hwnd, @title$, 256) If Asc(title$) And title$ = *ptr\title PokeL(@*ptr\hwnd, hwnd) ProcedureReturn 0 EndIf ProcedureReturn 1 EndProcedure Procedure EnumChildProc(hwnd.l, *ptr.winparam) Protected class${256}, text${256} GetClassName_(hwnd, @class$, 256) If Asc(class$) If Asc(*ptr\text) GetWindowText_(hwnd, @text$, 256) If text$ = *ptr\text *ptr\result + class$ + #LF$ EndIf Else *ptr\result + class$ + #LF$ EndIf EndIf ProcedureReturn 1 EndProcedure Procedure.s WinGetClassList(title$, text$ = "") Protected ptr.winparam ptr\title = title$ ptr\text = text$ EnumWindows_(@EnumWinProc(), @ptr) If ptr\hwnd EnumChildWindows_(ptr\hwnd, @EnumChildProc(), @ptr) ptr\result = RTrim(ptr\result, #LF$) ProcedureReturn ptr\result EndIf EndProcedure Debug WinGetClassList("Untitled — Notepad")
  4. @ghost911 Use version 6.0.4, this is the latest version that creates a compact executable file and is supported on WindowsXP. Version 6.11 the minimum size of the compiled executable file starts at 250 kb.
  5. imitation GUICtrlSetResizing()
  6. _TempFile -> TmpFile FileCreateShortcut -> CreateLink
  7. If you are interested in the SpiderBasic programming language, then look at my other projects in my signature on that forum. Sources included. You can see screenshots here
  8. Using SpiderBasic I built AutoIt3.apk. You can read more about the source here. screenshots: menu, settings, search
  9. Updated (09/26/2023)
  10. http://forum.oszone.net/post-1907424.html#post1907424 http://azjio.narod.ru/autoit3_docs/userfunctions/_NumberNumToName.htm https://www.autoitscript.com/forum/topic/142799-converting-numbers
  11. DLL Local $ErrorOutput = DllStructCreate("wchar[128]") Local $Output = DllStructCreate("wchar[1024]") Local $DeviceName ; Local Dim $aResult[5] Local $hDLL = DllOpen("PB.Ex_MTP_x64.dll") ; Local $hDLL = DllOpen("PB.Ex_MTP_x86.dll") If @error Then MsgBox(0, "", "@error") EndIf DllCall($hDLL, "int", "ExamineMTP", "ptr", DllStructGetPtr($ErrorOutput)) If @error Then MsgBox(0, "ExamineMTP", "@error") EndIf ; While 1 $aResult = DllCall($hDLL, "int", "NextMTPEntry", "ptr", DllStructGetPtr($ErrorOutput)) If @error Then MsgBox(0, "NextMTPEntry", "@error") EndIf ; If $aResult[0] Then DllCall($hDLL, "int", "MTPEntryName", "ptr", DllStructGetPtr($Output), "ptr", DllStructGetPtr($ErrorOutput)) $DeviceName = DllStructGetData($Output, 1) MsgBox(0, "", $DeviceName) ; EndIf ; Wend DllCall($hDLL, "int", "OpenMTP", "int", "1", "WSTR", $DeviceName, "ptr", DllStructGetPtr($ErrorOutput)) If @error Then MsgBox(0, "OpenMTP", "@error") EndIf DllCall($hDLL, "int", "GetMTPManufacturer", "int", "1", "ptr", DllStructGetPtr($Output), "ptr", DllStructGetPtr($ErrorOutput)) If @error Then MsgBox(0, "GetMTPManufacturer", "@error") EndIf MsgBox(0, "GetMTPManufacturer", DllStructGetData($Output, 1)) DllCall($hDLL, "int", "CloseMTP", "int", "1", "ptr", DllStructGetPtr($ErrorOutput)) DllClose($hDLL) $ErrorOutput = 0 $Output = 0 There are examples in PureBasic, but I'm too lazy to redo it.
  12. I tried to make functions for capturing text from Scintilla #include <WinAPI.au3> Global Const $SCI_GETLENGTH = 2006 Global Const $SCI_GETCHARACTERPOINTER = 2520 Global Const $SCI_GETRANGEPOINTER = 2643 Global Const $SCI_GETCODEPAGE = 2137 Global Const $SCI_GETCURRENTPOS = 2008 Global Const $SCI_GETANCHOR = 2009 Global Const $SC_CP_UTF8 = 65001 Global Const $PROCESS_ALL_ACCESS = 2035711 ; Global Const $SMTO_ABORTIFHUNG = 2 ; В оригинале на PureBasic для получения SCI_GETRANGEPOINTER используется WinAPI функция SendMessageTimeout(), ; хотя непонятно зачем, если получение указателя не является затратной по времени функцией Func GetScintillaText() Local $ReturnValue Local $tagSTRING Local $tBuffer Local $length Local $iPID, $hProcess, $iOffset ; вынести получение дескриптора за пределы функции $ScintillaHandle = ControlGetHandle('[CLASS:SciTEWindow]', "", "[CLASSNN:Scintilla1]") ; [CLASS:Notepad++] If $ScintillaHandle Then $length = _SendMessage($ScintillaHandle, $SCI_GETLENGTH, 0, 0) If $length Then $length += 2 $tagSTRING = "char strdata[" & $length & "]" ; $tagSTRING = "wchar strdata[" & $length & "]" ; $tagSTRING = "struct;wchar strdata[" & $length & "];endstruct" $tBuffer = DllStructCreate($tagSTRING) If Not $tBuffer Then ; получаем позицию данных в процессе Scintilla, чтобы прочитать данные по указателю в памяти $iOffset = _SendMessage($ScintillaHandle, $SCI_GETCHARACTERPOINTER, 0, 0) $CodePage = _SendMessage($ScintillaHandle, $SCI_GETCODEPAGE, 0, 0) If $iOffset Then _WinAPI_GetWindowThreadProcessId ($ScintillaHandle, $iPID) $hProcess = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, 0, $iPID) If $hProcess Then _WinAPI_ReadProcessMemory($hProcess, $iOffset, DllStructGetPtr($tBuffer), $length, 0) _WinAPI_CloseHandle($hProcess) $ReturnValue = DllStructGetData($tBuffer, "strdata") If $CodePage = $SC_CP_UTF8 Then ; Чтобы не тратить память на бинарную строку преобразование с помощью _WinAPI_MultiByteToWideChar $ReturnValue = _WinAPI_MultiByteToWideChar($ReturnValue, 65001, 0, True) ; $ReturnValue = StringToBinary($ReturnValue) ; $ReturnValue = BinaryToString($ReturnValue, 4) EndIf EndIf EndIf EndIf EndIf EndIf Return $ReturnValue EndFunc ; Func GetScintillaRangeText($cursor, $length) Func GetScintillaRangeText() Local $ReturnValue Local $tagSTRING Local $tBuffer Local $iPID, $hProcess, $iOffset Local $cursor, $anchor ; вынести получение дескриптора за пределы функции $ScintillaHandle = ControlGetHandle('[CLASS:SciTEWindow]', "", "[CLASSNN:Scintilla1]") ; [CLASS:Notepad++] If $ScintillaHandle Then ; вынести за скобки, чтобы функция могла захватывать диапазон не обязательно выделенный ; в кодировке UTF-8 есть однобайтовые и двубайтовые символы, поэтому позиция в байтах заданная ручками не всегда объективна, ; так как может встать на середину двухбайтового символа и результат неверный. А захват выделенного не имеет этой проблемы. ; Мы задаём в символах, а функция работает в байтах. ; Чтобы задать в символах можно попробовать получить в широких символах, а после преобразования ($CodePage) обрезать по числу символов. $cursor = _SendMessage($ScintillaHandle, $SCI_GETCURRENTPOS, 0, 0) $anchor = _SendMessage($ScintillaHandle, $SCI_GETANCHOR, 0, 0) If $anchor = $cursor Then Return "" EndIf If $anchor < $cursor Then $length = $cursor - $anchor $cursor = $anchor Else $length = $anchor - $cursor EndIf If $length Then $tagSTRING = "char strdata[" & $length & "]" ; $tagSTRING = "wchar strdata[" & $length & "]" ; $tagSTRING = "struct;wchar strdata[" & $length & "];endstruct" $tBuffer = DllStructCreate($tagSTRING) If Not $tBuffer Then ; получаем позицию данных со сдвигом к курсору в процессе Scintilla, чтобы прочитать данные по указателю в памяти $iOffset = _SendMessage($ScintillaHandle, $SCI_GETRANGEPOINTER, $cursor, 0) $CodePage = _SendMessage($ScintillaHandle, $SCI_GETCODEPAGE, 0, 0) If $iOffset Then _WinAPI_GetWindowThreadProcessId ($ScintillaHandle, $iPID) $hProcess = _WinAPI_OpenProcess($PROCESS_ALL_ACCESS, 0, $iPID) If $hProcess Then _WinAPI_ReadProcessMemory($hProcess, $iOffset, DllStructGetPtr($tBuffer), $length, 0) _WinAPI_CloseHandle($hProcess) $ReturnValue = DllStructGetData($tBuffer, "strdata") If $CodePage = $SC_CP_UTF8 Then ; Чтобы не тратить память на бинарную строку преобразование с помощью _WinAPI_MultiByteToWideChar $ReturnValue = _WinAPI_MultiByteToWideChar($ReturnValue, 65001, 0, True) ; $ReturnValue = StringToBinary($ReturnValue) ; $ReturnValue = BinaryToString($ReturnValue, 4) EndIf EndIf EndIf EndIf EndIf EndIf Return $ReturnValue EndFunc MsgBox(0, 'Весь текст', "|" & GetScintillaText() & "|") ; MsgBox(0, 'Сообщение', "|" & GetScintillaRangeText(7, 4) & "|") ; MsgBox(0, 'Сообщение', "|" & GetScintillaRangeText(8, 4) & "|") MsgBox(0, 'Выделенное', "|" & GetScintillaRangeText() & "|")
  13. Update Command line "TitlePart ClassWindow CurrentWord TestFlag" supported for 3rd party Scintilla editors. Now you can use the same executable for PureBasic, SciTE, Notepad++. In the description of the program, I added configuration files for SciTE and Notepad++ Added context menu with 5 items (Copy, Autohide, Next color, ini, Exit) Improved regular expressions, this increased the speed by almost 2 times. Calling the program again terminates the previous instance of the program. Bugfix: now precise positioning, expands collapsed code snippets.
  14. Update Regular expressions are now in the ini file
  15. FindAllReferencesSciTE screenshot Tool for SciTE to show all lines of code containing the selected keyword. Working with the program: 1. Select a function, variable, keyword or something else, or simply put the cursor on the word without selecting anything and press the hot key. 2. In the window that appears, there will be a table of all found lines with this word and the line number. Clicking on a line scrolls the SciTE code to the position of that line and you can edit at that point. Clicking in the header returns to its original position. 3. You can choose one of the ready-made regular expressions, for example "find all cycles", etc. and navigate through these elements. You can enter your regular expression and press Enter. 4. The window retains its dimensions, so drag to the right and increase in height. Download: yandex, upload.ee
  16. IniWrite uses CreatePreferences. This is wrong, as CreatePreferences creates an empty file and will destroy all preferences, leaving only one. MsgBox - you are using WinAPI, but you can use the original MessageRequester() function, then you get cross-platform code. StringIsDigit uses PCRE for you, but I gave you a function without using PCRE. Using PCRE adds 150 KB to the size of the executable. In this case, your file size will be almost the same as that of AutoIt3. FindPartialWindow() - why are you creating the t$=Space(999) variable inside the loop. This can be done 1 time outside the loop. Run() EnableExplicit Structure String2 key.s exec.s EndStructure ; modified function by reference to extract parameters and executable ; https://www.cyberforum.ru/pure-basic/thread3028721.html#post16492165 Procedure.s CmdLineRaw(*res.String2) Protected pos, Char.s pos = FindString(*res\exec, Chr(34), 1) If pos = 1 ; if you find a quote in the first character, then Char=quote, it means the path with spaces Char = Chr(34) Else Char = " " EndIf pos = FindString(*res\exec, Char, 2) ; looking for separator Char from the second character If pos > 0 pos + 1 If Mid(*res\exec, pos, 1) = " " pos + 1 EndIf ; found "pos" - the real position of the beginning of the com line *res\key = Right(*res\exec, Len(*res\exec) - pos + 1) ; options *res\exec = Left(*res\exec, pos - 1) ; executable EndIf EndProcedure Procedure Run(program.s, workdir.s = "", show_flag = 0, opt_flag = 0) Protected res.String2 res\exec = program res\key = "" CmdLineRaw(@res) show_flag & opt_flag ; I didn't check the flags ProcedureReturn RunProgram(res\exec, res\key, workdir, show_flag) EndProcedure ; Run(~"Explorer.exe /Select,\"C:\\Windows\\INF\"") Run("notepad.exe C:\Windows\system.ini") ; Run("cmd.exe /c (@Echo off & @Echo. & Color 1e & chkdsk.exe Z: /F /X& set /p Ok=^>^>)")
  17. before the ?m flag added the flag (*CRLF) for compatibility with versions higher than 3.3.8.1
  18. ghost911 look at the file (AU3toPB) more detailed
  19. StringStripWS https://www.purebasic.fr/english/viewtopic.php?t=79183
  20. StringIsDigit, StringIsFloat, StringIsXDigit (link) the behavior of the StringIsFloat function is slightly different EnableExplicit Procedure StringIsDigit(*text) Protected flag = #True, *c.Character = *text If *c = 0 Or *c\c = 0 ProcedureReturn 0 EndIf Repeat If *c\c < '0' Or *c\c > '9' flag = #False Break EndIf *c + SizeOf(Character) Until Not *c\c ProcedureReturn flag EndProcedure Debug StringIsDigit(@"123") Debug StringIsDigit(@"12 3") Debug StringIsDigit(@"") Debug "===" Procedure StringIsFloat(*text) Protected flag = #True, *c.Character = *text, sep = 0, increment = 1 If *c = 0 Or *c\c = 0 ProcedureReturn 0 EndIf Repeat If *c\c >= '0' And *c\c <= '9' ; Debug "-> 0-9" sep = increment ElseIf sep And *c\c = '.' ; Debug "-> ." If sep <= 0 ; Debug "-> Out2" flag = #False Break EndIf sep = 0 increment = -1 Else ; Debug "-> Out" flag = #False Break EndIf *c + SizeOf(Character) Until Not *c\c If sep <> -1 ; Debug "-> Out3" flag = #False EndIf ProcedureReturn flag EndProcedure Debug StringIsFloat(@"1.2") Debug StringIsFloat(@"1..2") Debug StringIsFloat(@"1.2.3") Debug StringIsFloat(@"1") Debug StringIsFloat(@"1.") Debug StringIsFloat(@".1") Debug StringIsFloat(@"qwerty") Debug StringIsFloat(@".") Debug StringIsFloat(@"") Debug "===" Procedure StringIsXDigit(*text) Protected flag = #True, *c.Character = *text If *c = 0 Or *c\c = 0 ProcedureReturn 0 EndIf Repeat If Not ((*c\c >= '0' And *c\c <= '9') Or (*c\c >= 'a' And *c\c <= 'f') Or (*c\c >= 'A' And *c\c <= 'F')) flag = #False Break EndIf *c + SizeOf(Character) Until Not *c\c ProcedureReturn flag EndProcedure Debug StringIsXDigit(@"123") Debug StringIsXDigit(@"FF34FF") Debug StringIsXDigit(@"") Debug StringIsXDigit(@" ")
  21. BigNum.au3 = bigint.pbi FileRecycle -> on WinAPI FileGetShortcut -> similar _ProcessGetPath -> ProcessNameFromHwnd
  22. AutoCompletionIDE Download yandex upload.ee Screenshot (here). Russian column names should be replaced in lst files. You can read more at the link here
  23. wrong         If $New[$i] - $t < $Old[$i] Then             $t = 1             $Old[$i] = $New[$i] + $L[$i] - $t - $Old[$i]         Else             $Old[$i] = $New[$i] - $t - $Old[$i]             $t = 0         EndIf right, correctly If $New[$i] - $t < $Old[$i] Then $Old[$i] = $New[$i] + $L[$i] - $t - $Old[$i] $t = 1 Else $Old[$i] = $New[$i] - $t - $Old[$i] $t = 0 EndIf
  24. You add browser check for IE only if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) // IE (4+) only You can add for FireFox function ClipBoard(NumBlok) { var input = document.createElement('textarea'); input.innerHTML = NumBlok.innerText; document.body.appendChild(input); input.select(); document.execCommand('copy'); document.body.removeChild(input); } Add to online documentation... universally: function ClipBoard(NumBlok) { var input = document.createElement('textarea'); if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4)) // IE (4+) only input.innerText = NumBlok.innerText; else input.innerHTML = NumBlok.innerText; document.body.appendChild(input); input.select(); document.execCommand('copy'); document.body.removeChild(input); }
×
×
  • Create New...