Jump to content

kashamalasha

Members
  • Posts

    17
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

kashamalasha's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. UPD: I found some script that works very similar with my requirements. But it can't react when I edit some text that has been already written. Could you help me fix it? Thanks. #include <guiconstantsex.au3> #include <guirichedit.au3> #include <windowsconstants.au3> #include <misc.au3> opt('guioneventmode', 1) global $g_hrichedit doit() func doit() local $hgui, $imsg, $idbtnnext, $istep = 0 $hgui = guicreate("", 320, 350, -1, -1) $g_hrichedit = _guictrlrichedit_create($hgui, "", 10, 10, 300, 220, _ bitor($es_multiline, $ws_vscroll, $ws_hscroll, $es_autovscroll)) guisetonevent($gui_event_close, '__exit') guisetstate(@sw_show) global $dll_32 = dllopen('user32.dll') sleep(2000) while 1 sleep(100) $last = 1000000 if (_ispressed(11, $dll_32) = false) and (_ispressed("08", $dll_32) _ or _ispressed(41, $dll_32) or _ispressed(42, $dll_32) or _ispressed(43, $dll_32) _ or _ispressed(44, $dll_32) or _ispressed(45, $dll_32) or _ispressed(46, $dll_32) _ or _ispressed(47, $dll_32) or _ispressed(48, $dll_32) or _ispressed(49, $dll_32) _ or _ispressed('4a', $dll_32) or _ispressed('4b', $dll_32) or _ispressed('4c', $dll_32) _ or _ispressed('4d', $dll_32) or _ispressed('4e', $dll_32) or _ispressed('4f', $dll_32) _ or _ispressed(50, $dll_32) or _ispressed(51, $dll_32) or _ispressed(52, $dll_32) _ or _ispressed(53, $dll_32) or _ispressed(54, $dll_32) or _ispressed(55, $dll_32) _ or _ispressed(56, $dll_32) or _ispressed(57, $dll_32) or _ispressed(58, $dll_32) _ or _ispressed(59, $dll_32) or _ispressed('5a', $dll_32)) then for $i = 1 to 2 guisetcursor(-1, '', $hgui) _guictrlrichedit_pauseredraw($g_hrichedit) $pos1 = _guictrlrichedit_getcharposofpreviousword($g_hrichedit, $last) if $pos1 < 0 then $i = 2 else _guictrlrichedit_setsel($g_hrichedit, $pos1, $last) $last = $pos1 $text = _guictrlrichedit_getseltext($g_hrichedit) if stringregexp($text, '(?:^func[ ]{0,100}$|^endfunc[ ]{0,100}$|^if[ ]{0,100}$|^endif[ ]{0,100}$)') then _guictrlrichedit_setcharcolor($g_hrichedit, 0x000099) _guictrlrichedit_setsel($g_hrichedit, -1, -1) elseif stringregexp($text, '(?:^include[ ]{0,100}$)') then _guictrlrichedit_setcharcolor($g_hrichedit, 0x009900) _guictrlrichedit_setsel($g_hrichedit, -1, -1) else _guictrlrichedit_setcharcolor($g_hrichedit, 0x000000) _guictrlrichedit_setsel($g_hrichedit, -1, -1) endif _GUICtrlRichEdit_GetCharPosFromXY($g_hrichedit, $hCharPos[0], $hCharPos[1]) endif next _guictrlrichedit_resumeredraw($g_hrichedit) endif wend endfunc func __exit() dllclose('user32.dll') exit endfunc
  2. I've tried your UDF, and it is not exact what I want. I want to implemnt syntax highlighting for the text on the fly. That means it should work like syntax highlighting in Notepad++ or like in Sublime Text editors. The user shouldn't push any button to highlight text in the editor. Thanks.
  3. ZPLII https://en.wikipedia.org/wiki/Zebra_(programming_language) and CPCL (Comtec Printer Control Language ) the both are page description language.
  4. Hi everybody. Could you tell me is there any UDF that can help to highlight syntax in the _GUICtrlRichEdit element on the fly? Is it possible to implement this feature in script in simple way using some UDF or something, instead of writing thousand of strings manually? Thanks in advance.
  5. Hi! It works. Thanks a lot.
  6. Hi! Is it possible to put some PNG file into the ExMsgBox instead of using $EMB_ constants? Thanks.
  7. Eventually I replaced GUICtrlCreateEdit with _GUICtrlRichEdit_Create. Thanks all.
  8. Hi! For example, as I post previously, I store a text file in my database in this format: ^XA ^FX Test script ^FD Test data ^XZ When I am trying to read it to GUICtrlCreateEdit via function GUICtrlSetData, it will be placed like this: ^XA^FX Test script^FD Test data^XZ The trick with function StringStripWS and StringReplace $aRow[0] = StringStripWS( _ StringReplace( _ StringReplace($aRow[0], "^", @CRLF & "^"), _ @CRLF & "^FS", "^FS"), _ $STR_STRIPLEADING) will convert it to this; ^XA ^FX Test script ^FD Test data ^XZ As you can see, there is no @CRLF that was there in the source file.
  9. Hi again! I tested my script using StringStripWS and StringReplace tricks and find out that it works correct only if I don't have empty lines in my multilines text files in DB. E.g. if I store text like this: ^XA ^FX Test script ^FD Test data ^XZ my script will return me using $aRow[0] = StringStripWS( _ StringReplace( _ StringReplace($aRow[0], "^", @CRLF & "^"), _ @CRLF & "^FS", "^FS"), _ $STR_STRIPLEADING) text formatted like this: ^XA ^FX Test script ^FD Test data ^XZ Could you tell me, how can I fix it using the same trick with StringStripWS? Thanks.
  10. IC. I'll try to add WinGetPos before every InputBox in my code. Thanks.
  11. Nope. It doesn't work. Try to move your $hGUI window between the events. You will see that InputBox will appear with the wrong coordinates, regardless parent window.
  12. Hi, guys. Could you help me to understand how to place child elements like MsgBox, InputBox etc. inside parent element? I want to set padding from top border of $hMainGui equal 20px and from left border equal 20px. Is it possible? Thanks in advance.
  13. Yeah! That's work! Thanks a lot. You save me from this: If StringLen(_GUICtrlRichEdit_GetText($hRichEdit)) > 0 Then _GUICtrlRichEdit_SetSel($hRichEdit, 0, -1, True) _GUICtrlRichEdit_ReplaceText($hRichEdit, $aRow[0]) Else _GUICtrlRichEdit_InsertText($hRichEdit, $aRow[0]) EndIf And other nice features of UDF like WM_SIZE.
  14. Example: ^XA ^FX | Delete files from FLASH (E:) | ^FS ^IDE:X5_*.*^FS ^XZ Screenshot from ConsoleWrite:
  15. Hello. Could you help me find the answer for my issue. I'm trying to set fomatted data wich is selected from SQL to GUICtrlCreateEdit field. And the GUICtrlSetData function is inserting it in one line. But when I'm trying to do the same using MsgBox the data looks fine. I'm trying to not use _GUICtrlRichEdit UDF. Thanks in advance. Here is my test code. #include <GUIConstants.au3> #include <GUIListBox.au3> #include <SQLite.au3> #include <SQLite.dll.au3> Opt("GUIOnEventMode", 1) $hMainGUI = GUICreate("Test", 520, 240) $hListBox = _GUICtrlListBox_Create($hMainGUI, "", 10, 10, 180, 80) $hEdit = GUICtrlCreateEdit("", 10, 80, 500, 150) GUISetState(@SW_SHOW, $hMainGUI) GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") Local $hQuery, $aRow _SQLite_Startup() $hDB = _SQLite_Open('MyDB.sqlite') _SQLite_Query(-1, "SELECT ID ||"". "" || Name FROM Templates ORDER BY ID;", $hQuery) While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK _GUICtrlListBox_AddString($hListBox, $aRow[0]) WEnd GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSE_Button") While 1 Sleep(100) WEnd Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $hWndListBox If Not IsHWnd($hListBox) Then $hWndListBox = GUICtrlGetHandle($hListBox) $hWndFrom = $lParam $iIDFrom = BitAND($wParam, 0xFFFF) ; Low Word $iCode = BitShift($wParam, 16) ; Hi Word Switch $hWndFrom Case $hListBox, $hWndListBox Switch $iCode Case $LBN_DBLCLK Select_Template(_GUICtrlListBox_GetCurSel($hListBox) + 1) Return 0 EndSwitch EndSwitch EndFunc ;==>_WM_COMMAND Func CLOSE_Button() _SQLite_Close() _SQLite_Shutdown() Exit EndFunc ;==>CLOSE_Button Func Select_Template($sListItem) _SQLite_QuerySingleRow($hDB, _ "SELECT Content " & _ "FROM Templates " & _ "WHERE ID = " & $sListItem & ";", $aRow) ;~ MsgBox(64, "Test: " & $sListItem, $aRow[0]) GUICtrlSetData($hEdit, $aRow[0]) WinSetTitle($hMainGUI, "", "Test: " & $sListItem) EndFunc ;==>Select_Template
×
×
  • Create New...