Search the Community
Showing results for tags 'rich text'.
-
For Example I'm Reading Clipboard Which is having a Link Copied From any webpage. Copied Link Will Be In Rich Text, How to Convert This link to Plain Text Rich Text : https://www.autoitscript.com Plain Text : https://www.autoitscript.com
-
I've been working with RichEdits and have come upon the very useful RESH UDF. But I baffled by one statement in the example's _LoadFile() function: _GUICtrlRichEdit_ReplaceText($hRichEdit, '') Can someone explain this "non-replace"? Here's the context:
-
This is a basic editor that uses IE functions and jasvscript/css to control the display and highlight terms. It sets the html docuement in to edit mode, to be used as the edit box, and the javascript scans and runs the highlighter onkeyup. The example is set to highlight "If", "Then" and "EndIf". If you were to type "endif", it would automatically change it to "EndIf" and highlight it. Example Source Code: #NoTrayIcon #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <IE.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) Opt("GUIResizeMode", $GUI_DOCKAUTO) Opt("TrayMenuMode", 3) Local $html = '', $r = @CRLF $html &= '<html>'&$r $html &= '<head>'&$r $html &= ' <script type="text/javascript">'&$r $html &= ' function HighlightSyntax(word,highlightcolor) {'&$r $html &= ' var replacement = "<span class=''color-" + highlightcolor + "''>" + word + "</span>";' $html &= ' var re = new RegExp(word, "ig");' $html &= ' document.body.innerHTML = document.body.innerHTML.replace(re, replacement);' $html &= ' '&$r $html &= ' }'&$r $html &= ' function SyntaxHighlighter() {'&$r $html &= ' HighlightSyntax("EndIf","blue");'&$r $html &= ' HighlightSyntax("If","blue");'&$r $html &= ' HighlightSyntax("Then","blue");'&$r $html &= ' }'&$r $html &= ' </script>'&$r $html &= ' <style type="text/css">'&$r $html &= ' html, body { width: 100%; height: 100%; background: #FFFFFF; color: #000000; border: 0px none; font-family: times; font-size: 14px; padding: 0px; margin: 0px; }'&$r $html &= ' p { padding: 0px; margin: 0px; }'&$r $html &= ' .color-blue { color: #0000FF; }'&$r $html &= ' </style>'&$r $html &= '</head>'&$r $html &= '<body onkeyup="SyntaxHighlighter()" contenteditable="true" designMode="on">'&$r $html &= '</body>'&$r $html &= '</html>' Global $UI_FORM = GUICreate("Syntax Highlighting, Resizable Rich Text Editor", 601, 371, 192, 124, BitOR($GUI_SS_DEFAULT_GUI,$WS_MAXIMIZEBOX,$WS_CLIPCHILDREN,$WS_TABSTOP,$WS_SIZEBOX), BitOR($WS_EX_TRANSPARENT,$WS_EX_WINDOWEDGE)) Local $UI_MENU_File = GUICtrlCreateMenu("&File") Global $UI_MENU_Exit = GUICtrlCreateMenuItem("&Exit", $UI_MENU_File) Global $UI_IE = _IECreateEmbedded() Global $UI_IEOject = GUICtrlCreateObj($UI_IE, 0, 0, 600, 350) GUICtrlSetOnEvent($UI_MENU_Exit, "GUI_Close") GUISetOnEvent($GUI_EVENT_CLOSE, "GUI_Close", $UI_FORM) GUICtrlSetResizing($UI_IEOject, $GUI_DOCKAUTO) GUISetState(@SW_SHOW, $UI_FORM) _IENavigate($UI_IE, "about:blank") _IEDocWriteHTML($UI_IE, $html) While 1 Sleep(10) WEnd Func GUI_Close() GUIDelete($UI_FORM) Exit EndFunc
-
- syntax
- highlighting
-
(and 3 more)
Tagged with: