Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 02/08/2023 in all areas

  1. Kanashius

    listview edit udf

    This UDF can be used to simply edit an Listview. There will be created an inputfield at the position of the subitem, with enter you save, use esc to interrupt,... You can specify single rows and cols or single field (giving row and col,...), also you can specify, if a singleclick or a doubleclick is needed to edit. If you like it, please leave me a comment, also if you have any suggestions to make it better or if you found bugs. I reworked the UDF with AutoIt v3.3.16.1 and added the functionality to use tab to go to the next cell. Files without version numbers contain the current version. Changelog: v1.1.0: - Release v2.0.0: - Add the ability to switch to the next editable cell with tab - Rework to AutoIt v3.3.16.1 (partly) using maps v3.0.0: - Fully reworked to use maps instead of structs (more flexibility/performance) - Uses maps to save editable rows/cols to make ..._isCellEditable faster (No string parsing every time) - Bugfixes v3.0.1: - Fixes Bug with the registered keys not working systemwide v3.0.2: - Fixes Bug where the key input gui wide - The last edited item is now selected - The selection moves with the editable cell, when using ..__updateNextCellIndex (Using the tab key) ListViewEditInput_v1_1_0.au3 Example_v1_1_0.au3 Example_v2_0_0.au3 ListViewEditInput_v2_0_0.au3 Example.au3 ListViewEditInput.au3
    1 point
  2. ioa747

    SciTE PlusBar

    SciTE PlusBar a attached Menu bar for SciTE Version 1.0.0.32 SciTE_PlusBar.zip Please, leave your comments and experiences here Thanks !
    1 point
  3. For a project of mine i needed Hyperlink creating in GuiRichEdit. These functions and some functions from @UEZ, 1 function from @corgannoand some Global Const from @velted (autoit.de) i put in this UDF. #INCLUDE-ONCE #AUTOIT3WRAPPER_AU3CHECK_PARAMETERS=-Q -D -W 1 -W 2 -W 3 -W 4 #INCLUDE <GUICONSTANTSEX.AU3> ;; #INCLUDE <WINDOWSCONSTANTS.AU3> #INCLUDE <GDIPLUS.AU3> #INCLUDE <GUIRICHEDIT.AU3> #INCLUDE <URLFRIENDLY.AU3> #INCLUDE <WINAPISYS.AU3> #INCLUDE <ARRAY.AU3> #INCLUDE <STRING.AU3> #INCLUDE <DATE.AU3> #INCLUDE <RTF_PRINTER.AU3> ; FEHLENDE KONSTANTEN ;HTTPS://AUTOIT.DE/THREAD/87954-RICHEDIT-VERLINKEN-EINER-DATEI-PER-DRAG-AND-DROP/?POSTID=709978#POST709978 GLOBAL CONST $AURL_ENABLEURL = 1 ; FÜE $EM_AUTOURLDETECT GLOBAL CONST $AURL_ENABLEDRIVELETTERS = 16 ; FÜR $EM_AUTOURLDETECT GLOBAL CONST $ECOOP_OR = 2 ; FÜR $EM_SETOPTIONS GLOBAL CONST $ECO_SELECTIONBAR = 0X01000000 ; FÜR $EM_SETOPTIONS GLOBAL CONST $ES_NOOLEDRAGDROP = 0X08 ; RICHEDIT CONTROLSTYLE GLOBAL CONST $SES_HYPERLINKTOOLTIPS = 8 ; FÜR $EM_SETEDITSTYLE GLOBAL CONST $TAGENDROPFILES = $TAGNMHDR & ";HANDLE HDROP;LONG CP;BOOL FPROTECTED" ; FÜR $EN_DROPFILES ;GLOBAL CONST $TAGDROPFILES = $TAGNMHDR & ";HANDLE HDROP;LONG CP;BOOL FPROTECTED" #REGION FILEINSTALL AND OTHER DIRECTORIES GLOBAL $G_SAPPINIT = @APPDATADIR & '\GUIRICHEDITPLUS\INIT' ;FILEINSTALL FOR EX. ;DUMMY (=SHELLEXUTE-) PRINTER AND HIS SOURCE IF NOT FILEEXISTS($G_SAPPINIT) THEN DIRCREATE($G_SAPPINIT) GLOBAL $SPRNEXE = $G_SAPPINIT & '\RTF_SHELLEXPRINT.EXE ' GLOBAL $G_SAPPWORK = @APPDATADIR & '\GUIRICHEDITPLUS\WORK.TMP' IF NOT FILEEXISTS($G_SAPPWORK) THEN DIRCREATE($G_SAPPWORK) ;SHELLEXECUTE($G_SAPPINIT GLOBAL $G_SAPPICONS = @APPDATADIR & '\GUIRICHEDITPLUS\ICONS' IF NOT FILEEXISTS($G_SAPPICONS) THEN DIRCREATE($G_SAPPICONS) GLOBAL $G_SAPPEXAMPLES = @APPDATADIR & '\GUIRICHEDITPLUS\EXAMPLES' IF NOT FILEEXISTS($G_SAPPEXAMPLES) THEN DIRCREATE($G_SAPPEXAMPLES) #ENDREGION FILEINSTALL AND OTHER DIRECTORIES ;ERÄNZENDE GLOBALEN VARS GLOBAL $G_SSAVEPATH, $G_SVERSNR GLOBAL $G_BSAVEIT = FALSE ;FALSE: NO MASGBOX|TRUE: A MSGBOX REMEMBERS TO SAVE GLOBAL $G_REDEBUG = FALSE ;TRUE CONSOLE OUTPUT FOR DEGBUG REASONS GLOBAL $G_BENCODE = FALSE ;FALSE = SPAVE > '_' |TRUE = ENCODES A STRING TO BE URL-FRIENDLY PRACTICAL ENCODING (ENCODE ONLY WHAT IS NECESSARY) GLOBAL $G_SALLOWEDEXT = 'AU3,TXT,RTF,PDF,ICO,JPG,PNG,MP3,MP4' ;ALLOWED FILE-EXTENSIONS AUTOSHELLEXECUTE ON DBLCLICK ;NEW FUNC'S FUNC _GUICTRLRICHEDIT_INSERTFILELINK($HWND, $SFILE, $SDISPLAY, $BCRLF = FALSE, $BENCODE = $G_BENCODE) ;AUTOR AUTOBERT $SDISPLAY = ' ' & $SDISPLAY & ' ' IF $G_REDEBUG THEN CONSOLEWRITE('INSERTFILELINK: ' & $SFILE & @TAB & $SDISPLAY & @CRLF) IF NOT FILEEXISTS(STRINGREPLACE($SFILE, '_', ' ')) AND _ ;FOR THOSE PEOPLE WHICH USES THIS SIMPLEST ENCODING IN MAIN-SCRIPT (NOBODY? AND ME) NOT FILEEXISTS($SFILE) THEN RETURN SETERROR(1, 1, '') $SFILE = STRINGREPLACE('FILE:\' & $SFILE, '\', '\\\\') IF $BENCODE THEN $SFILE = _URLENCODE($SFILE) ELSE ; $SFILE = STRINGREPLACE($SFILE, '_', ' ') ENDIF LOCAL $STEXT LOCAL CONST $SBINEND = '}}' LOCAL CONST $SBINLINK = '{\FIELD{\*\FLDINST{HYPERLINK "' LOCAL CONST $SBINDISPLAY = '{\FLDRSLT\UL\CF1 ' LOCAL CONST $SBINENDLINE = '\UL0\CF0}}\F0\FS17 ' LOCAL $SLINK = "{\RTF1" & $SBINLINK & $SFILE & '"' & $SBINEND & $SBINDISPLAY & $SDISPLAY & $SBINENDLINE & $SBINEND & $SBINEND IF $BCRLF THEN $SLINK &= '\PAR\PAR}' & @CRLF LOCAL $IRET = _GUICTRLRICHEDIT_INSERTTEXT($HWND, $SLINK) LOCAL $IEXT = @EXTENDED IF $BCRLF THEN _GUICTRLRICHEDIT_INSERTTEXT($HWND, @CRLF) IF $G_REDEBUG THEN CONSOLEWRITE($SLINK & @TAB & $IRET & '|' & $IEXT & @CRLF) IF $IRET THEN RETURN SETERROR($IRET, $IEXT, $IRET) ELSE RETURN SETERROR($IRET, $IEXT, $SLINK) ENDIF ENDFUNC ;==>_GUICTRLRICHEDIT_INSERTFILELINK FUNC _GUICTRLRICHEDIT_INSERTLINK($HWND, $SURL, $SDISPLAY, $BCRLF = FALSE, $BENCODE = $G_BENCODE) #cs CAN BE USED FOR ALL LINKS, IF NOT WORK FOR FILES USE _GUICTRLRICHEDIT_INSERTFILELINK ;AUTOR AUTOBERT #ce $SDISPLAY = ' ' & $SDISPLAY & ' ' IF $G_REDEBUG THEN CONSOLEWRITE('INSERTLINK: ' & $SURL & @TAB & $SDISPLAY & @CRLF) LOCAL CONST $ALINKS[4] = ['HTTP:', 'FTP:', 'WWW.', 'HINT:'] LOCAL $SMODE = '/\' FOR $I = 0 TO 3 IF STRINGINSTR($SURL, $ALINKS[$I]) THEN $SMODE = '\/' NEXT IF $SMODE = '\/' THEN $SURL = STRINGREPLACE($SURL, '\', '/') ELSE $SURL = STRINGREPLACE($SURL, '/', '\') $SURL = STRINGREPLACE('FILE:\' & $SURL, '\', '\\\\') ENDIF IF $BENCODE THEN $SURL = _URLENCODE($SURL) ELSE ; $SURL = STRINGREPLACE($SURL, '_', ' ') ENDIF LOCAL $STEXT LOCAL CONST $SBINEND = '}}' LOCAL CONST $SBINLINK = '{\FIELD{\*\FLDINST{HYPERLINK "' LOCAL CONST $SBINDISPLAY = '{\FLDRSLT\UL\CF1' LOCAL CONST $SBINENDLINE = '\UL0\CF0}}\F0\FS17' LOCAL $SLINK = "{\RTF1" & $SBINLINK & $SURL & '"' & $SBINEND & $SBINDISPLAY & $SDISPLAY & $SBINENDLINE & $SBINEND & $SBINEND IF $BCRLF THEN $SLINK &= '\PAR\PAR}' & @CRLF LOCAL $IRET = _GUICTRLRICHEDIT_INSERTTEXT($HWND, $SLINK) LOCAL $IEXT = @EXTENDED IF $BCRLF THEN _GUICTRLRICHEDIT_INSERTTEXT($HWND, @CRLF) IF $G_REDEBUG THEN CONSOLEWRITE($SURL & @TAB & $IRET & '|' & $IEXT & @CRLF) IF $IRET THEN RETURN SETERROR($IRET, $IEXT, $IRET) ELSE RETURN SETERROR($IRET, $IEXT, $SURL) ENDIF ENDFUNC ;==>_GUICTRLRICHEDIT_INSERTLINK FUNC _GUICTRLRICHEDIT_GETLINK($HWND, $WPARAM, $LPARAM, $BENCODE = $G_BENCODE) ;AUTOR AUTOBERT IF $G_REDEBUG THEN CONSOLEWRITE('GETFILELINK: ' & $WPARAM & '|' & $LPARAM & '|' & $G_BENCODE & @CRLF) LOCAL $TENLINK, $CPMIN, $CPMAX, $SLINK, $SDISPLAY, $ASPLIT $TENLINK = DLLSTRUCTCREATE($TAGENLINK, $LPARAM) $CPMIN = DLLSTRUCTGETDATA($TENLINK, "CPMIN") $CPMAX = DLLSTRUCTGETDATA($TENLINK, "CPMAX") $SLINK = _GUICTRLRICHEDIT_GETTEXTINRANGE($HWND, $CPMIN, $CPMAX) IF $G_REDEBUG THEN CONSOLEWRITE('LINK RAW: :' & $SLINK & @CRLF) $SLINK = STRINGREPLACE($SLINK, 'FILE:', '') IF $BENCODE THEN $SLINK = _URLDECODE($SLINK) ELSE ;$SLINK = STRINGREPLACE($SLINK, '_', ' ') ENDIF $SLINK = _REMOVETRAILINGBACKSLASH('\' & $SLINK) ;CONSOLEWRITE('\ REMOVED: ' & @EXTENDED & @CRLF) IF $G_REDEBUG THEN CONSOLEWRITE('LINK DECODED: ' & $SLINK & @CRLF) IF FILEEXISTS($SLINK) THEN RETURN SETERROR(1, 0, $SLINK) ELSE RETURN SETERROR(0, 9998, $SLINK) ENDIF ;IF $G_REDEBUG THEN ENDFUNC ;==>_GUICTRLRICHEDIT_GETLINK FUNC _REMOVETRAILINGBACKSLASH($STEXT) ;NEEDED FOR _GUICTRLRICHEDIT_GETFILELINK AND MAYBE OTHERWHERE ;AUTOR AUTOBERT LOCAL $IPOS, $IREPLACED DO $IPOS = STRINGINSTR($STEXT, '\') IF $IPOS < 2 THEN $STEXT = STRINGREPLACE($STEXT, '\', '', 1) IF NOT @ERROR THEN $IREPLACED += 1 ENDIF UNTIL $IPOS > 1 RETURN SETERROR(0, $IREPLACED, $STEXT) ENDFUNC ;==>_REMOVETRAILINGBACKSLASH FUNC _GUICTRLRICHEDIT_SAVE($HWND, $SPATH = $G_SSAVEPATH, $BSAVEIT = TRUE) ;AUTOR AUTOBERT IF NOT $BSAVEIT THEN $BSAVEIT = _GUICTRLRICHEDIT_ISMODIFIED($HWND) ;IF _GUICTRLRICHEDIT_GETLINECOUNT($HWND) = 0 THEN RETURN SETERROR(TRUE, 7777, 0) ;NOT A REAL ERROR 7777 = NOTHING TO DO LOCAL $SRET, $IEXT IF NOT $BSAVEIT THEN IF MSGBOX(BITOR($MB_ICONQUESTION, $MB_YESNO), 'SAVE BEFORE EXIT', 'WITHOUT CHANGES ARE BE LOST!', 0, $HWND) = $IDYES THEN $BSAVEIT = TRUE ENDIF IF $BSAVEIT THEN ;INCLUDE ALREADY EXITING FILECHECKING _GUICTRLRICHEDIT_DESELECT($HWND) $SRET = _GUICTRLRICHEDIT_STREAMTOFILE($HWND, $SPATH, FALSE, $SFF_PLAINRTF, 1031) ;, BITOR($FO_OVERWRITE, $FO_CREATEPATH,$FO_ANSI )) $IEXT = @ERROR ELSE $SRET = FALSE $IEXT = 9999 ENDIF ;IF $G_REDEBUG THEN CONSOLEWRITE(@SCRIPTLINENUMBER & @TAB & $G_SSAVEPATH & @TAB & 'SAVED: ' & $SRET & @TAB & $IEXT & @CRLF) RETURN SETERROR($SRET, $IEXT, $SRET) ENDFUNC ;==>_GUICTRLRICHEDIT_SAVE FUNC _GUICTRLRICHEDIT_PRINT($HWND, $SPATH = $G_SSAVEPATH) ;AUTOR AUTOBERT LOCAL $SRET LOCAL $SRTF_NAME = $SPATH ;_GETPRINTFILENAME($SPATH) ;MSGBOX(0, 'PRINT', $SRTF_NAME) _GUICTRLRICHEDIT_DESELECT($HWND) ;IF _GUICTRLRICHEDIT_GETLINECOUNT($HWND) = 0 THEN RETURN SETERROR(TRUE, 7777, 0) ;NOT A REAL ERROR 7777 = NOTHING TO DO $SRET = _GUICTRLRICHEDIT_STREAMTOFILE($HWND, $SPATH, FALSE, $SFF_PLAINRTF, 1031) ;, BITOR($FO_OVERWRITE, $FO_CREATEPATH,$FO_ANSI)) IF $G_REDEBUG THEN CONSOLEWRITE(@SCRIPTLINENUMBER & ': ' & $SRET & '|' & @ERROR & @CRLF) IF @ERROR THEN RETURN SETERROR(@ERROR, @ERROR, $SRTF_NAME) IF NOT FILEEXISTS($SPRNEXE) THEN MSGBOX(BITOR($MB_ICONERROR, $MB_TASKMODAL), 'PRINT', $SPRNEXE & 'NOT FOUND!', 0, $HWND) ;_SHOWBUSY() ;LOCAL $SARCHIV = @SCRIPTDIR & '\ARCHIV' ;CONSOLEWRITE($SARCHIV & @CRLF) LOCAL $SPRINT = STRINGFORMAT('%S "" "" "PRINT" @SW_HIDE', $SRTF_NAME) LOCAL $IPID = RUN($SPRNEXE & $SPRINT, "", @SW_HIDE) IF $G_REDEBUG THEN CONSOLEWRITE('RTF_SHELLEXPRINT.EXE ' & $SPRINT & ' RET: ' & INT($IPID) & '|' & @ERROR & @CRLF) ;#CS WHILE PROCESSEXISTS($IPID) SLEEP(100) WEND RETURN SETERROR($IPID, 8888, '') ;ERROR CODE NOCH "NORMEN" ENDFUNC ;==>_GUICTRLRICHEDIT_PRINT FUNC _GETPRINTFILENAME($STEXT) LOCAL $IPOS = STRINGINSTR($STEXT, '\', 0, -1) LOCAL $SRET = STRINGMID($STEXT, $IPOS + 1) ;$IPOS = STRINGINSTR($SRET, '.', 0, -1) $STEXT = STRINGREPLACE($STEXT, $SRET, '~PRN~' & $SRET) ;MSGBOX(64, '', $STEXT, 20) RETURN SETERROR(0, $IPOS, $STEXT) ENDFUNC ;==>_GETPRINTFILENAME #REGION FILES FROM @UEZ FUNC _GUICTRLRICHEDIT_INSERTBITMAP($HWND, $SFILE, $SFORMATFUNCTIONS = "\", $SBITMAPFUNCTIONS = "\", $IBGCOLOR = DEFAULT) ;CODED BY UEZ BUILD 2016-02-16 # HTTPS://WWW.AUTOITSCRIPT.COM/FORUM/TOPIC/180635-HOW-TO-INSERT-PICTURE-TO-RICH-EDIT/?DO=FINDCOMMENT&COMMENT=1296908 IF NOT FILEEXISTS($SFILE) THEN RETURN SETERROR(0, 0, 1) IF NOT _WINAPI_ISCLASSNAME($HWND, $__G_SRTFCLASSNAME) THEN RETURN SETERROR(0, 0, 2) _GDIPLUS_STARTUP() LOCAL $HIMAGE = _GDIPLUS_IMAGELOADFROMFILE($SFILE) IF @ERROR THEN _GDIPLUS_SHUTDOWN() RETURN SETERROR(0, 0, 3) ENDIF LOCAL CONST $ADIM = _GDIPLUS_IMAGEGETDIMENSION($HIMAGE) LOCAL CONST $HBITMAP = _GDIPLUS_BITMAPCREATEFROMSCAN0($ADIM[0], $ADIM[1]), $HGFX = _GDIPLUS_IMAGEGETGRAPHICSCONTEXT($HBITMAP) IF $IBGCOLOR = DEFAULT THEN $IBGCOLOR = 0XFF000000 + _WINAPI_SWITCHCOLOR(_GUICTRLRICHEDIT_GETBKCOLOR($HWND)) ENDIF _GDIPLUS_GRAPHICSCLEAR($HGFX, $IBGCOLOR) _GDIPLUS_GRAPHICSDRAWIMAGERECT($HGFX, $HIMAGE, 0, 0, $ADIM[0], $ADIM[1]) _GDIPLUS_GRAPHICSDISPOSE($HGFX) LOCAL $BINSTREAM = _GDIPLUS_STREAMIMAGE2BINARYSTRING($HBITMAP, "BMP") IF @ERROR THEN _GDIPLUS_IMAGEDISPOSE($HIMAGE) _GDIPLUS_IMAGEDISPOSE($HBITMAP) _GDIPLUS_SHUTDOWN() RETURN SETERROR(0, 0, 4) ENDIF LOCAL $BINBMP = STRINGMID($BINSTREAM, 31) LOCAL CONST $BINRTF = "{\RTF1\VIEWKIND4" & $SFORMATFUNCTIONS & " {\PICT{\*\PICPROP}" & $SBITMAPFUNCTIONS & "DIBITMAP " & $BINBMP & "}\PAR}" ;CHECK OUT HTTP://WWW.BIBLIOSCAPE.COM/RTF15_SPEC.HTM _GUICTRLRICHEDIT_APPENDTEXT($HWND, $BINRTF) $BINSTREAM = 0 $BINBMP = 0 _GDIPLUS_IMAGEDISPOSE($HIMAGE) _GDIPLUS_IMAGEDISPOSE($HBITMAP) _GDIPLUS_SHUTDOWN() RETURN 1 ENDFUNC ;==>_GUICTRLRICHEDIT_INSERTBITMAP FUNC _GDIPLUS_STREAMIMAGE2BINARYSTRING($HBITMAP, $SFORMAT = "JPG", $IQUALITY = 80, $BSAVE = FALSE, $SFILENAME = @SCRIPTDIR & "\CONVERTED.JPG") ;CODED BY UEZ 2013 BUILD 2014-01-25 (BASED ON THE CODE BY ANDREIK) LOCAL $SIMGCLSID, $TGUID, $TPARAMS, $TDATA SWITCH $SFORMAT CASE "JPG" $SIMGCLSID = _GDIPLUS_ENCODERSGETCLSID($SFORMAT) $TGUID = _WINAPI_GUIDFROMSTRING($SIMGCLSID) $TDATA = DLLSTRUCTCREATE("INT QUALITY") DLLSTRUCTSETDATA($TDATA, "QUALITY", $IQUALITY) ;QUALITY 0-100 LOCAL $PDATA = DLLSTRUCTGETPTR($TDATA) $TPARAMS = _GDIPLUS_PARAMINIT(1) _GDIPLUS_PARAMADD($TPARAMS, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $PDATA) CASE "PNG", "BMP", "GIF", "TIF" $SIMGCLSID = _GDIPLUS_ENCODERSGETCLSID($SFORMAT) $TGUID = _WINAPI_GUIDFROMSTRING($SIMGCLSID) CASE ELSE RETURN SETERROR(1, 0, 0) ENDSWITCH LOCAL $HSTREAM = _WINAPI_CREATESTREAMONHGLOBAL() ;HTTP://MSDN.MICROSOFT.COM/EN-US/LIBRARY/MS864401.ASPX IF @ERROR THEN RETURN SETERROR(2, 0, 0) _GDIPLUS_IMAGESAVETOSTREAM($HBITMAP, $HSTREAM, DLLSTRUCTGETPTR($TGUID), DLLSTRUCTGETPTR($TPARAMS)) IF @ERROR THEN RETURN SETERROR(3, 0, 0) LOCAL $HMEMORY = _WINAPI_GETHGLOBALFROMSTREAM($HSTREAM) ;HTTP://MSDN.MICROSOFT.COM/EN-US/LIBRARY/AA911736.ASPX IF @ERROR THEN RETURN SETERROR(4, 0, 0) LOCAL $IMEMSIZE = _MEMGLOBALSIZE($HMEMORY) IF NOT $IMEMSIZE THEN RETURN SETERROR(5, 0, 0) LOCAL $PMEM = _MEMGLOBALLOCK($HMEMORY) $TDATA = DLLSTRUCTCREATE("BYTE[" & $IMEMSIZE & "]", $PMEM) LOCAL $BDATA = DLLSTRUCTGETDATA($TDATA, 1) _WINAPI_RELEASESTREAM($HSTREAM) ;HTTP://MSDN.MICROSOFT.COM/EN-US/LIBRARY/WINDOWS/DESKTOP/MS221473(V=VS.85).ASPX _MEMGLOBALFREE($HMEMORY) IF $BSAVE THEN LOCAL $HFILE = FILEOPEN($SFILENAME, 18) IF @ERROR THEN RETURN SETERROR(6, 0, $BDATA) FILEWRITE($HFILE, $BDATA) FILECLOSE($HFILE) ENDIF RETURN $BDATA ENDFUNC ;==>_GDIPLUS_STREAMIMAGE2BINARYSTRING #ENDREGION FILES FROM @UEZ #REGION FILES FROM CORGANO FUNC _GUICTRLRICHEDIT_APPENDTEXTEX($RICHEDIT, $TEXT, $FONT = "ARIAL", $COLOR = "000000", $SIZE = 12, $BOLD = 0, $ITALIC = 0, $STRIKE = 0, $UNDERLINE = 0) LOCAL $COMMAND = "{\RTF1\ANSI" LOCAL $R, $G, $B, $UL[9] = ["8", '\UL', '\ULDB', '\ULTH', '\ULW', '\ULWAVE', '\ULD', '\ULDASH', '\ULDASHD'] $TEXT = STRINGREPLACE($TEXT, '\', '\\') ;EINGEFÜGT AUTOBERT IF $FONT <> "" THEN $COMMAND &= "{\FONTTBL\F0\F" & $FONT & ";}" IF $COLOR <> "" THEN IF STRINGLEN($COLOR) <> 6 AND STRINGLEN($COLOR) = 8 THEN RETURN SETERROR(1) $B = DEC(STRINGRIGHT($COLOR, 2)) IF @ERROR THEN SETERROR(1, 1) $COLOR = STRINGTRIMRIGHT($COLOR, 2) $G = DEC(STRINGRIGHT($COLOR, 2)) IF @ERROR THEN SETERROR(1, 2) $COLOR = STRINGTRIMRIGHT($COLOR, 2) $R = DEC(STRINGRIGHT($COLOR, 2)) IF @ERROR THEN SETERROR(1, 3) IF $R + $B + $G > 0 THEN $COMMAND &= "{\COLORTBL;\RED" & $R & "\GREEN" & $G & "\BLUE" & $B & ";}\CF1" ENDIF ENDIF IF $SIZE THEN $COMMAND &= "\FS" & ROUND($SIZE * 2) & " " IF $STRIKE THEN $COMMAND &= "\STRIKE " IF $ITALIC THEN $COMMAND &= "\I " IF $BOLD THEN $COMMAND &= "\B " IF $UNDERLINE > 0 AND $UNDERLINE < 9 THEN $COMMAND &= $UL[$UNDERLINE] & " " RETURN _GUICTRLRICHEDIT_APPENDTEXT($RICHEDIT, $COMMAND & STRINGREPLACE($TEXT, @CRLF, "\LINE") & "}") ENDFUNC ;==>_GUICTRLRICHEDIT_APPENDTEXTEX FUNC _GUICTRLRICHEDIT_INSERTTEXTEX($RICHEDIT, $TEXT, $FONT = "ARIAL", $COLOR = "000000", $SIZE = 12, $BOLD = 0, $ITALIC = 0, $STRIKE = 0, $UNDERLINE = 0) #AUTOR COPY&PASTE + SEARCH&REPLACE FROM _GUICTRLRICHEDIT_APPENDTEXT LOCAL $COMMAND = "{\RTF1\ANSI" LOCAL $R, $G, $B, $UL[9] = ["8", '\UL', '\ULDB', '\ULTH', '\ULW', '\ULWAVE', '\ULD', '\ULDASH', '\ULDASHD'] $TEXT = STRINGREPLACE($TEXT, '\', '\\') ;EINGEFÜGT AUTOBERT IF $FONT <> "" THEN $COMMAND &= "{\FONTTBL\F0\F" & $FONT & ";}" IF $COLOR <> "" THEN IF STRINGLEN($COLOR) <> 6 AND STRINGLEN($COLOR) = 8 THEN RETURN SETERROR(1) $B = DEC(STRINGRIGHT($COLOR, 2)) IF @ERROR THEN SETERROR(1, 1) $COLOR = STRINGTRIMRIGHT($COLOR, 2) $G = DEC(STRINGRIGHT($COLOR, 2)) IF @ERROR THEN SETERROR(1, 2) $COLOR = STRINGTRIMRIGHT($COLOR, 2) $R = DEC(STRINGRIGHT($COLOR, 2)) IF @ERROR THEN SETERROR(1, 3) IF $R + $B + $G > 0 THEN $COMMAND &= "{\COLORTBL;\RED" & $R & "\GREEN" & $G & "\BLUE" & $B & ";}\CF1" ENDIF ENDIF IF $SIZE THEN $COMMAND &= "\FS" & ROUND($SIZE * 2) & " " IF $STRIKE THEN $COMMAND &= "\STRIKE " IF $ITALIC THEN $COMMAND &= "\I " IF $BOLD THEN $COMMAND &= "\B " IF $UNDERLINE > 0 AND $UNDERLINE < 9 THEN $COMMAND &= $UL[$UNDERLINE] & " " RETURN _GUICTRLRICHEDIT_INSERTTEXT($RICHEDIT, $COMMAND & STRINGREPLACE($TEXT, @CRLF, "\LINE") & "}") ENDFUNC ;==>_GUICTRLRICHEDIT_INSERTTEXTEX #ENDREGION FILES FROM CORGANO The script where these funcs are used and tested : #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile_x64=..\..\..\Desktop\DirListSDI.exe #AutoIt3Wrapper_AU3Check_Parameters=-q -d -w 1 -w 2 -w 3 -w 4 #AutoIt3Wrapper_Run_Tidy=y #Au3Stripper_Parameters=/mo #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <GUIConstantsEx.au3> ;; #include <WindowsConstants.au3> #include <GuiStatusBar.au3> #include <GuiRichEditPlus_433.au3> #include <WinAPISys.au3> #include <WinAPIDlg.au3> #include <Array.au3> #include <String.au3> #include <GuiSlider.au3> #include <File.au3> #include <ScreenCapture.au3> #Region Fileinstall Global $iError = FileInstall("C:\File.Installer\RTF_SHellExPrint.exe", $g_sAppInit & "\RTF_SHellExPrint.exe", 1) $iError = FileInstall("C:\File.Installer\RTF_SHellExPrint.au3", $g_sAppInit & "\RTF_SHellExPrint.au3", 1) #EndRegion Fileinstall #Region Assign global vars (if needed) $g_bEncode = False ;(False: no encoding, True Filename encoding = on $g_REDebug = False Global $g_ToPrint = False Global $iBold ConsoleWrite($g_bEncode & @CRLF) #EndRegion Assign global vars (if needed) ;$g_sSavePath = $g_sAppWork & '\Directory Listing.rtf' ;StringReplace($g_sSavePath, @ScriptDir, 'x:') ;Test for errorhandling throws erros ######################################################## If FileExists($g_sSavePath) Then FileDelete($g_sSavePath) ######################################################## Global Const $g_aToLower = StringSplit('notneeded,', ',', 3) ;substrings => lowercase Global $sTitle = 'GuiRichEditPlus_Example ' & $g_sVersNr, $oldText, $newText Global $hGUI = GUICreate($sTitle, 600, 400, -1, 100) Global $g_aFileList, $g_Busy, $g_inserted, $g_failed Global $g_hRichEdit = _GUICtrlRichEdit_Create($hGUI, "", 10, 10, 580, 380, BitOR($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL)) ;_GUICtrlRichEdit_AutoDetectURL($g_hRichEdit, True) ;If FileExists($g_sSavePath) Then _GUICtrlRichEdit_StreamFromFile($g_hRichEdit, $g_sSavePath) ; In this example allway start empty ;_WinAPI_DragAcceptFiles($g_hRichEdit) ;not wanted in this example ;_GUICtrlRichEdit_SetEventMask($g_hRichEdit, BitOR($ENM_DROPFILES, $ENM_LINK)) ;not wanted in this example _GUICtrlRichEdit_SetEventMask($g_hRichEdit, $ENM_LINK) ;not wanted in this example _SendMessage($g_hRichEdit, $EM_SETEDITSTYLE, $SES_HYPERLINKTOOLTIPS, $SES_HYPERLINKTOOLTIPS) ;_SendMessage($g_hRichEdit, $EM_SETZOOM, 1000, 500) ; erwarte 200% GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") GUIRegisterMsg($WM_SIZE, "WM_SIZE") Global $aParts[4] = [32, 90, 80, -1] Global $g_hStatus = _GUICtrlStatusBar_Create($hGUI, $aParts) Global $idAnim = GUICtrlCreateIcon('Shell32.dll', -24, 0, 0) Global $hAnim = GUICtrlGetHandle($idAnim) _GUICtrlStatusBar_EmbedControl($g_hStatus, 0, $hAnim) _GUICtrlStatusBar_SetMinHeight($g_hStatus, 38) _GUICtrlStatusBar_SetParts($g_hStatus, $aParts) _GUICtrlStatusBar_SetText($g_hStatus, 'Debug: ' & $g_REDebug, 1) _GUICtrlStatusBar_EmbedControl($g_hStatus, 0, $hAnim) ;ConsoleWrite('Icons' & _GUICtrlStatusBar_SetIcon($g_hStatus, 2, 23, "SyncCenter.dll")) WinMove($hGUI, '', 0, 0, @DesktopWidth, @DesktopHeight) GUISetState() Global $sListdir Global Const $sInitDir = @ProgramFilesDir Global $hBrowseLiatProc = DllCallbackRegister('_BrowseLiatProc', 'int', 'hwnd;uint;lparam;ptr') Global $pBrowseLiatProc = DllCallbackGetPtr($hBrowseLiatProc) Global $pText = _WinAPI_CreateString($sInitDir) Do $sListdir = _WinAPI_BrowseForFolderDlg(_WinAPI_PathStripToRoot($sInitDir), 'Select a folder from the list below.', BitOR($BIF_RETURNONLYFSDIRS, $BIF_EDITBOX, $BIF_VALIDATE), $pBrowseLiatProc, $pText) ConsoleWrite($sListdir & @CRLF) Until Not @error _WinAPI_FreeMemory($pText) If $sListdir Then ConsoleWrite('--------------------------------------------------' & @CRLF) ConsoleWrite($sListdir & @CRLF) EndIf ;$aChar = StringSplit($sListdir, '', 3) ;_ArrayDisplay($aChar) DllCallbackFree($hBrowseLiatProc) $g_sSavePath = $g_sAppWork & '\Directory Listing ' & StringReplace(StringTrimLeft($sListdir, 3), '\', ' ') & '.rtf' ;StringReplace($g_sSavePath, @ScriptDir, 'x:') ;Test for errorhandling throws erros ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $g_sSavePath = ' & $g_sSavePath & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console _GUICtrlStatusBar_SetText($g_hStatus, '_FileListToArrayRec ', 1) $g_Busy = True AdlibRegister('_ShowBusy', 20) $g_aFileList = _FileListToArrayRec($sListdir, '*', $FLTAR_FILESFOLDERS, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH) ;If Not IsArray($g_aFileList) Then Exit MsgBox _GUICtrlRichEdit_InsertTextEx($g_hRichEdit, "Install Directory Structure" & @CRLF & @CRLF, "Arial", "FF1234", 20) _GUICtrlRichEdit_InsertTextEx($g_hRichEdit, "" & @CRLF & @CRLF, "Arial", "000000", 1) _GUICtrlRichEdit_SetFont($g_hRichEdit, 'Arial', 1) ;_GUICtrlRichEdit_StreamToFile($g_hRichEdit, $g_sSavePath) _GUICtrlRichEdit_SetModified($g_hRichEdit, False) _GUICtrlRichEdit_insertLink($g_hRichEdit, 'hint://Info: LastSaved: ' & _NowCalc(), 'LS') _ArrayInsert($g_aFileList, 1, $sListdir) $g_aFileList[0] += 1 ;_ArrayDisplay($g_aFileList) _ArrayColInsert($g_aFileList, 1) _GUICtrlStatusBar_SetText($g_hStatus, 'RichEdit_insertLink(s)', 1) ; $g_Busy = True For $i = 1 To $g_aFileList[0][0] Switch GUIGetMsg() Case $Gui_EVENT_CLOSE If MsgBox(BitOR($MB_ICONQUESTION, $MB_YESNO), 'User break ', 'Realy end dir listing ? ' & @CRLF _ & "It can't continued" & @CRLF & ' You have To restart it!') = $IDYES Then _GUICtrlRichEdit_AppendTextEx($g_hRichEdit, "User break: " & @UserName, "Arial", "FA4321", 24, $iBold) ExitLoop EndIf Case Else $g_aFileList[$i][1] = _GetDisplayName($g_aFileList[$i][0]) Switch @extended Case 0 #cs _GUICtrlRichEdit_SetCharBkColor($g_hRichEdit, '009999') _GUICtrlRichEdit_SetCharAttributes($g_hRichEdit, '+bo') _GUICtrlRichEdit_InsertText($g_hRichEdit, StringReplace($g_aFileList[$i][0], $g_aFileList[$i][1], '')) #ce $iBold = 1 _GUICtrlRichEdit_AppendTextEx($g_hRichEdit, StringReplace($g_aFileList[$i][0], $g_aFileList[$i][1], ''), "Arial", "FA4321", 14, $iBold) $iBold = 0 _GUICtrlRichEdit_AppendTextEx($g_hRichEdit, ' ', "", "881111", 10, $iBold) ContinueCase Case Else If _GUICtrlRichEdit_insertLink($g_hRichEdit, $g_aFileList[$i][0], $g_aFileList[$i][1], True) Then $g_inserted += 1 Else $g_failed += 1 EndIf $g_inserted &= ' ' & _FormatedStatPer($i, $g_aFileList[0][0]) $g_failed &= ' ' & _FormatedStatPer($i, $g_aFileList[0][0]) _GUICtrlStatusBar_SetText($g_hStatus, $g_inserted, 1) _GUICtrlStatusBar_SetText($g_hStatus, $g_failed, 2) EndSwitch EndSwitch Next _GUICtrlRichEdit_SetCharAttributes($g_hRichEdit, '+hi') _GUICtrlRichEdit_insertLink($g_hRichEdit, 'hint://' & $g_inserted & ' Links succesfully inserted.| Links total: ' & $g_aFileList[0][0], 'Status', True) For $i = 1 To 5 Do Until GUIGetMsg() = 0 Next $g_Busy = False ;#ce Global $nMsg While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE _GUICtrlRichEdit_Deselect($g_hRichEdit) If $nMsg = _GUICtrlRichEdit_GetLineLength($g_hRichEdit, 1) = 0 Then $g_ToPrint = _GUICtrlRichEdit_Save($g_hRichEdit, $g_sSavePath, True) ;ConsoleWrite($nMsg & '|' & @error & '|' & @extended & @CRLF) _GUICtrlRichEdit_Destroy($g_hRichEdit) ; needed unless script crashes ;GUIDelete() Else $g_ToPrint = False EndIf If $g_ToPrint Then _PrintIt() Exit #cs Case $idPrint If _GUICtrlRichEdit_IsModified($g_hRichEdit) Then _GUICtrlRichEdit_StreamToFile($g_hRichEdit, $g_sSavePath) _GUICtrlRichEdit_SetModified($g_hRichEdit, False) EndIf _PrintIt($g_sSavePath) #ce ;Case $idZoom ;_Zoom() EndSwitch WEnd Func _FormatedStatPer($iDone, $iAll) Return (Ceiling($iDone * 100 / $iAll) & '%') EndFunc ;==>_FormatedStatPer ;#cs ;_GUICtrlRichEdit_ReplaceFieldValue($g_sSavePath, 'LastSaved: ', '"}', _NowCalc()) Func _Zoom() #cs Local $ipos = GUICtrlRead($idZoom) Switch $ipos + 50 Case 0 To 49 ConsoleWrite('<100%' & @CRLF) Case 50 ConsoleWrite('100%' & @CRLF) Case Else ConsoleWrite('>100%' & @CRLF) EndSwitch #ce EndFunc ;==>_Zoom Func _PrintIt($sPath = $g_sSavePath) If MsgBox(BitOR($MB_ICONQUESTION, $MB_YESNO), 'Print', $sPath) = $IDNO Then Return SetError(False, 88, '') $g_Busy = True ConsoleWrite($g_sAppInit & @CRLF) Local $sPRNexe = $g_sAppInit & '\RTF_SHellExPrint.exe ' If Not FileExists($sPRNexe) Then Return MsgBox(BitOR($MB_ICONERROR, $MB_TASKMODAL), 'Print', $sPRNexe & 'not found!', 0, $hGUI) _ShowBusy() ;Local $sArchiv = @ScriptDir & '\Archiv' ;ConsoleWrite($sArchiv & @CRLF) Local $sPrint = StringFormat('%s "" "" "Print" @SW_HIDE', StringReplace($sPath, ' ', '%20')) Local $iPid = Run($sPRNexe & $sPrint, "", @SW_HIDE) ConsoleWrite('RTF_SHellExPrint.exe ' & $sPrint & ' Ret: ' & Int($iPid) & '|' & @error & @CRLF) ;#cs While ProcessExists($iPid) Sleep(100) WEnd ;#ce $g_Busy = False #cs ; here Setting default margin - all = 1 centimeters ; you can set your own margins _RTF_SetMargins() ; here setting number of copies - default is 1 _RTF_SetNumberOfCopies(1) ; here getting data to Print Local $vRTF_Stream = _GUICtrlRichEdit_StreamToVar($g_hRichEdit) ; and here Printing _RTF_PrintFile($vRTF_Stream, Default, True, True) #ce ; here Setting default margin - all = 1 centimeters EndFunc ;==>_PrintIt Func _GetDisplayName($sText) Local $ipos = StringInStr($sText, '\', 0, -1) Local $sRet = _StringProper(StringMid($sText, $ipos + 1)) $sRet = _CheckToLower($sRet) $ipos = StringInStr($sRet, '.', 0, -1) Return SetError(0, $ipos, $sRet) EndFunc ;==>_GetDisplayName Func _CheckToLower($sText) For $i = 0 To UBound($g_aToLower) - 1 If StringInStr($sText, $g_aToLower[$i]) Then For $j = 1 To 4 Switch $j Case 1 $sText = StringReplace($sText, '-' & $g_aToLower[$i] & '-', ' ' & $g_aToLower[$i] & ' ') If @extended Then ContinueLoop Case 2 $sText = StringReplace($sText, $g_aToLower[$i] & '-', $g_aToLower[$i] & ' ') If @extended Then ContinueLoop Case 3 If @extended Then ContinueLoop $sText = StringReplace($sText, '-' & $g_aToLower[$i], ' ' & $g_aToLower[$i]) Case 4 $sText = StringReplace($sText, $g_aToLower[$i], $g_aToLower[$i]) EndSwitch Next ;ConsoleWrite($g_aToLower[$i] & @TAB) EndIf Next ;ConsoleWrite($sText & @CRLF) Return $sText EndFunc ;==>_CheckToLower Func _ShowBusy() Local Static $iBusy Local $sBusy ;ConsoleWrite($iBusy & @TAB) AdlibUnRegister('_ShowBusy') $iBusy += 1 If $iBusy < 23 Then $iBusy = 23 If $iBusy > 30 Then $iBusy = 23 ;$sBusy = $g_sAppIcons & '\SyncCenter_' & $iBusy & '.ico' ;ConsoleWrite($sBusy & @CRLF) GUICtrlSetImage($idAnim, 'SyncCenter.dll', ($iBusy + 1) * -1) ;to show Busy Icons If $g_Busy Then AdlibRegister('_ShowBusy', 20) Else ; WinSetTitle($hGUI, "", $sTitel) & $sProgVer & $sDLLName) GUICtrlSetImage($idAnim, 'SyncCenter', $iBusy * -1 + 1) EndIf EndFunc ;==>_ShowBusy Func WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam Local $hWndFrom, $iCode, $tNMHDR, $aFileList, $tDropFiles, $hDrop, $tEnLink, $cpMin, $cpMax, $tMsgFilter, $ipos, $sLink, $sDisplay, $aSplit, $iInserted, $sRet ; Local $hWndFrom, $iCode, $tNMHDR, $tNMHDR = DllStructCreate($tagNMHDR, $lParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $g_hRichEdit Switch $iCode Case $EN_DROPFILES ;Droped File Names extrahieren $tDropFiles = DllStructCreate($tagENDROPFILES, $lParam) $hDrop = DllStructGetData($tDropFiles, "hDrop") $aFileList = _WinAPI_DragQueryFileEx($hDrop, 0) For $i = 1 To $aFileList[0] $sLink = $aFileList[$i] $aSplit = StringSplit($sLink, '\', 1) $sDisplay = $aSplit[$aSplit[0]] $sRet = _GUICtrlRichEdit_insertLink($g_hRichEdit, $sLink, $sDisplay, True) If $sRet = True Then $iInserted += 1 Else ConsoleWrite($i & ': ' & $sRet & 'Failed') EndIf Next _GUICtrlRichEdit_SetSel($g_hRichEdit, -1, -1) ;_GUICtrlRichEdit_SetSel($hWndFrom, $tDropFiles.cp, $tDropFiles.cp) If Not $g_REDebug Then ConsoleWrite($iInserted & ' FileLinks inserted' & @CRLF) Return 1 Case $iCode = $EN_LINK ;ConsoleWrite('$EN_LINK' & @CRLF) $tMsgFilter = DllStructCreate($tagMSGFILTER, $lParam) If DllStructGetData($tMsgFilter, "msg") = $WM_LBUTTONDBLCLK Then $tEnLink = DllStructCreate($tagENLINK, $lParam) $cpMin = DllStructGetData($tEnLink, "cpMin") $cpMax = DllStructGetData($tEnLink, "cpMax") $sLink = _GUICtrlRichEdit_GetTextInRange($g_hRichEdit, $cpMin + 6, $cpMax) ConsoleWrite($sLink & ': ' & @error & '|' & @extended & @CRLF) _GetDisplayName($sLink) Switch @extended Case 0 ;quickckeck for Directory ShellExecute($sLink) ;opens a explorer link Case Else If FileExists($sLink) Then If StringInStr($g_sAllowedExt, StringRight($sLink, 3)) Then ShellExecute($sLink) Else MsgBox(64, 'Link:', $sLink) EndIf Else ;it must be a hint or file is delete MsgBox(64, 'Hint:', StringReplace($sLink, '/', '')) EndIf EndSwitch EndIf EndSwitch #cs Case $hZoom Switch $iCode Case $NM_RELEASEDCAPTURE ; The control is releasing mouse capture _WM_NOTIFY_DebugEvent("$NM_RELEASEDCAPTURE", $tagNMHDR, $lParam, "hWndFrom,IDFrom") ; No return value EndSwitch #ce EndSwitch Return $Gui_RUNDEFMSG EndFunc ;==>WM_NOTIFY Func WM_SIZE($hWndGUI, $MsgID, $wParam, $lParam) Local $iWidth = _WinAPI_LoWord($lParam) Local $iHeight = _WinAPI_HiWord($lParam) ; _WinAPI_MoveWindow($g_hRichEdit, 0, 0, $iWidth, $iHeight) _WinAPI_MoveWindow($g_hRichEdit, 4, 4, $iWidth - 8, $iHeight - 44) _WinAPI_MoveWindow($g_hStatus, 2, 2, $iWidth - 4, $iHeight - 38) ;Return 1 Return 0 ; "an application should return zero if it processes this message" (MSDN) EndFunc ;==>WM_SIZE Func _BrowseProc($hWnd, $iMsg, $wParam, $lParam) Local $sPath, $hSearch Switch $iMsg Case $BFFM_INITIALIZED _WinAPI_SetWindowText($hWnd, 'MyTitle') _SendMessage($hWnd, $BFFM_SETSELECTIONW, 1, $lParam) Case $BFFM_SELCHANGED $sPath = _WinAPI_ShellGetPathFromIDList($wParam) $hSearch = FileFindFirstFile($sPath & '\*') If Not @error Then ConsoleWrite($sPath & @CRLF) EndIf Case $BFFM_VALIDATEFAILED MsgBox(($MB_ICONERROR + $MB_SYSTEMMODAL), 'Error', _WinAPI_GetString($wParam) & ' is invalid.', 0, $hWnd) Return 1 EndSwitch Return $hSearch EndFunc ;==>_BrowseProc maybe a mvp will proof and polish the code and integrate them in the GuiRichedit.UDF. What's new: small fixes/changes in GuiRichEditPlus_433.au3using Example:DirListSDI.au3you can select the directory which should be listed. This example will be extended to a MDI. Realy new: RTF_SHellExPrint.au3please complile and copy the exe to ..\AppData\Roaming\GuiRichEditPlus\Init. ) I suggest: using _GUICtrlRichEdit_insertLink for all kind of links which should work with files also, if not use _GUICtrlRichEdit_insertFileLink. Handle all kind of Links in theWM_Notify (like i did in _GuiRichEditPlus_Demo. 3. a small test to insert hint's is tested in Case $Gui_EVENT_CLOSE _GUICtrlRichEdit_insertLink($g_hRichEdit, 'hint://Info: GuiRichEditPlus(_3).au3 autor autobert', 'Version') Use the added Global $g_bEncode = False ;False = no encoding |True = Encodes a string to be URL-friendly Practical Encoding (Encode only what is necessary) in your Mainscript. #Region ReAssign global vars (if needed) $g_sSavePath = @ScriptDir & '\Rezeptsammlung.rtf' $g_bEncode = True ;(True Filename encoding = on) $g_REDebug = False ConsoleWrite($g_bEncode & @CRLF) #EndRegion Assign global vars (if needed) A real integrated the Statusbar is a future plan. UrlFriendly.au3 GuiRichEditPlus.au3 GuiRichEditPlus_2.au3 GuiRichEditPlus_3.au3 GuiRichEditPlus_4.au3 GuiRichEditPlus_42.au3 GuiRichEditPlus_Demo.au3
    1 point
  4. Probably depends on how and when you want to use the data. With _SQLite_Query you need to use _SQLite_FetchData to read the data, but you don't have to do it as the SQL is ran. So you can do the query now and use the data later. To me _SQLite_Query + _SQLite_FetchData is probably the correct way to go for reading/selecting data (or I prefer _SQLite_GetTable2D). _SQLite_Exec would be for anything that you aren't expecting to get data back for, like inserting, creating, updating, etc. I added on some code to give an example of how you could reference a column by name, instead of by ID: ;https://www.autoitscript.com/forum/topic/209644-sqlite-select-exec-or-query/ #include <Constants.au3> #include <MsgBoxConstants.au3> #include <SQLite.au3> #include <SQLite.dll.au3> ;~ Opt('MustDeclareVars', 1) Const $SQLITEDB = ":memory:" Local $hDskDb, $hQuery, $aRow, $sMsg _SQLite_Startup() If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "SQLite3.dll Can't be Loaded!") Exit -1 EndIf ConsoleWrite("_SQLite_LibVersion=" & _SQLite_LibVersion() & @CRLF) $hDskDb = _SQLite_Open($SQLITEDB) If @error Then MsgBox($MB_SYSTEMMODAL, "SQLite Error", "Can't open the database!") Exit -1 EndIf _SQLite_Exec(-1, ";create table if not exists content ( id integer primary key, title text null, animal text null ) ;") _SQLite_Exec(-1, "; insert into content ( title, animal ) values ('meow', 'cat'), ('woof', 'dog'), ('oink', 'pig'), ('ribbit', 'frog');") _SQLite_Query(-1, "SELECT id,title,animal FROM content;", $hQuery) ; the query $sMsg = "" While _SQLite_FetchData($hQuery, $aRow) = $SQLITE_OK $sMsg &= $aRow[0] & "," & $aRow[1] & @CRLF WEnd ConsoleWrite($sMsg) _SQLite_QueryFinalize($hQuery) Local $d = _SQLite_Exec(-1, "SELECT id,title,animal FROM content", "_cb") ; _cb will be called for each row Func _cb($aResult) For $s In $aResult ConsoleWrite($s & @TAB) Next ConsoleWrite(@CRLF) ; Return $SQLITE_ABORT ; Would Abort the process and trigger an @error in _SQLite_Exec() EndFunc ;==>_cb _SQLite_Query(-1, "SELECT id,title,animal FROM content;", $hQuery) ; the query Local $aColNames _SQLite_FetchNames($hQuery, $aColNames) ;~ _ArrayDisplay($aColNames) _GetColumnByName($aColNames) _SQLite_QueryFinalize($hQuery) Local $aResult, $iRows, $iColumns, $iRval $iRval = _SQLite_GetTable2D(-1, "SELECT * FROM content;", $aResult, $iRows, $iColumns) ;~ _ArrayDisplay($aResult) ConsoleWrite(@CRLF & 'Referencing columns by name' & @CRLF) ConsoleWrite(' id column id: ' & _GetColumnByName('id') & @CRLF) ConsoleWrite(' title column id: ' & _GetColumnByName('title') & @CRLF) ConsoleWrite('animal column id: ' & _GetColumnByName('animal') & @CRLF) For $iRow = 1 To UBound($aResult) - 1 ConsoleWrite('Loading row: ' & $iRow & @CRLF) ConsoleWrite(' id: ' & $aResult[$iRow][_GetColumnByName('id')] & @CRLF) ConsoleWrite(' title: ' & $aResult[$iRow][_GetColumnByName('title')] & @CRLF) ConsoleWrite(' animal: ' & $aResult[$iRow][_GetColumnByName('animal')] & @CRLF) Next Local $aResult, $iRows, $iColumns, $iRval $iRval = _SQLite_GetTable2D(-1, "SELECT * FROM content;", $aResult, $iRows, $iColumns) ;~ _ArrayDisplay($aResult) _GetColumnByName($aResult) ConsoleWrite(@CRLF & 'Referencing columns by name (from _SQLite_GetTable2D)' & @CRLF) ConsoleWrite(' id column id: ' & _GetColumnByName('id') & @CRLF) ConsoleWrite(' title column id: ' & _GetColumnByName('title') & @CRLF) ConsoleWrite('animal column id: ' & _GetColumnByName('animal') & @CRLF) For $iRow = 1 To UBound($aResult) - 1 ConsoleWrite('Loading row: ' & $iRow & @CRLF) ConsoleWrite(' id: ' & $aResult[$iRow][_GetColumnByName('id')] & @CRLF) ConsoleWrite(' title: ' & $aResult[$iRow][_GetColumnByName('title')] & @CRLF) ConsoleWrite(' animal: ' & $aResult[$iRow][_GetColumnByName('animal')] & @CRLF) Next Func _GetColumnByName($vColumnName = '') Local Static $aColumns[1] If IsArray($vColumnName) Then If UBound($vColumnName, 2) > 0 Then ReDim $aColumns[UBound($vColumnName, 2)] For $iIndex = 0 To UBound($vColumnName, 2) - 1 $aColumns[$iIndex] = $vColumnName[0][$iIndex] Next Else ; 1d array, such as from _SQLite_FetchNames ReDim $aColumns[UBound($vColumnName)] For $iIndex = 0 To UBound($vColumnName) - 1 $aColumns[$iIndex] = $vColumnName[$iIndex] Next EndIf Return SetError(0, 0, True) EndIf For $iIndex = 0 To UBound($aColumns) - 1 If StringCompare($vColumnName, $aColumns[$iIndex], 0) = 0 Then Return SetError(0, 0, $iIndex) EndIf Next Return SetError(1, 0, -1) EndFunc ;==>_GetColumnByName _SQLite_Close($hDskDb) _SQLite_Shutdown() It uses _SQLite_FetchNames, however you could skip that step and instead use _SQLite_GetTable2D to 'build' the column names in _GetColumnByName (would require changing it a bit to utilize/search the 2d array). However to use it as is, get the column names with _SQLite_FetchNames and pass that array into _GetColumnByName, then you can call _GetColumnByName('ColName') and it should return the index for that column name (though if your column doesn't exist it'll have a bad time)
    1 point
  5. You can try SendMessage or PostMessage, though not all windows will accept the commands (unless you get tricky with it, maybe). Try out this script. I works for pasting in SciTE, Windows Explorer and Notepad, but it didn't work in Visual Studio Code or Chrome, for example. It should work fine in an AutoIt GUI though. #include <SendMessage.au3> HotKeySet('[', '_Go') While 1 Sleep(10) WEnd Func _Go() Local $hHwnd = WinGetHandle('[ACTIVE]') Local $hCtrlHnd = ControlGetFocus($hHwnd) $hCtrlHnd = ControlGetHandle($hHwnd, '', $hCtrlHnd) _SendMessage($hCtrlHnd, $WM_PASTE) EndFunc Edit: plugging it into your script works: #include <SendMessage.au3> #include <GUIConstantsEx.au3> Example() Func Example() GUICreate("My GUI", 320, 120) Local $idFile = GUICtrlCreateInput("Sends simulated keystrokes to the active window.", 10, 5, 300, 20) Local $idBtn = GUICtrlCreateButton("Ok", 40, 75, 60, 20) GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $idBtn ControlFocus("My GUI", "", "Edit1") Local $hHwnd = WinGetHandle('[ACTIVE]') Local $hCtrlHnd = ControlGetFocus($hHwnd) $hCtrlHnd = ControlGetHandle($hHwnd, '', $hCtrlHnd) _SendMessage($hCtrlHnd, $WM_PASTE) ConsoleWrite(ClipGet() & @CRLF) EndSwitch WEnd EndFunc ;==>Example
    1 point
  6. Here is what I use for this kind of things, hope it will help in a way or another : (?is)"([^"]*?\.(?:jpg|png))"
    1 point
×
×
  • Create New...