Jump to content

AZJIO

Active Members
  • Posts

    1,692
  • Joined

  • Last visited

  • Days Won

    6

AZJIO last won the day on December 30 2019

AZJIO had the most liked content!

4 Followers

About AZJIO

  • Birthday 01/01/2014

Profile Information

  • Location
    Russian

Recent Profile Visitors

1,592 profile views

AZJIO's Achievements

  1. 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
  2. Using SpiderBasic I built AutoIt3.apk. You can read more about the source here. screenshots: menu, settings, search
  3. 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
  4. 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.
  5. 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() & "|")
  6. 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.
  7. Update Regular expressions are now in the ini file
  8. 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
  9. 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=^>^>)")
  10. before the ?m flag added the flag (*CRLF) for compatibility with versions higher than 3.3.8.1
  11. StringStripWS https://www.purebasic.fr/english/viewtopic.php?t=79183
  12. 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(@" ")
×
×
  • Create New...