Ascend4nt Posted June 23, 2009 Posted June 23, 2009 (edited) Hi, I recently found a need to do conversion of regular (ANS) strings to HTML code, replacing all the special tag items with special codes (example: "<" will be converted to "<"). What I'm wondering is - is there an easier way to do this then the code below? Note the example text here is: special//?<>chara¢cters&"in&strings;''<woo\> and its echoed to the console in converted format preceded by 'Body HTML:' Thanks! _IEErrorHandlerRegister () $oIE = _IECreateEmbedded () GUICreate("Embedded Web control Test", 100, 100,0,0) $GUIActiveX = GUICtrlCreateObj($oIE, 10, 10, 50, 50) _IENavigate($oIE,'about:blank') _IEAction ($oIE, "refresh") ; Send just the bare minimum elements of a webpage _IEDocWriteHTML ($oIE, "<html><body>"&@CRLF&"</body>"&@CRLF&"</html>") $oBody = _IETagNameGetCollection($oIE, "body", 0) _IEDocInsertText($oBody,'special//?<>chara¢cters&"in&strings;'&"''"&'<woo\>',"afterbegin") $sBodyText=_IEBodyReadHTML($oIE) ; Necessary because the returned code can contain quotes, which will mess things up for me: $sBodyText=StringReplace(StringReplace($sBodyText,'"',"""),"'","&"&"#092;") ConsoleWrite("Body HTML:"&@CRLF&$sBodyText&@CRLF) *edit: 'refresh' in the wrong spot. (not even sure where/when its necessary?) Edited June 23, 2009 by ascendant My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Ascend4nt Posted June 23, 2009 Author Posted June 23, 2009 oMBRa, No, that's for making usable URL's - that wouldn't work in creating HTML code. But hey, thanks for the effort - I didn't even know what that function did until I just tried it (documentation is a little lackluster for it) My contributions: Performance Counters in Windows - Measure CPU, Disk, Network etc Performance | Network Interface Info, Statistics, and Traffic | CPU Multi-Processor Usage w/o Performance Counters | Disk and Device Read/Write Statistics | Atom Table Functions | Process, Thread, & DLL Functions UDFs | Process CPU Usage Trackers | PE File Overlay Extraction | A3X Script Extract | File + Process Imports/Exports Information | Windows Desktop Dimmer Shade | Spotlight + Focus GUI - Highlight and Dim for Eyestrain Relief | CrossHairs (FullScreen) | Rubber-Band Boxes using GUI's (_GUIBox) | GUI Fun! | IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) | Magnifier (Vista+) Functions UDF | _DLLStructDisplay (Debug!) | _EnumChildWindows (controls etc) | _FileFindEx | _ClipGetHTML | _ClipPutHTML + ClipPutHyperlink | _FileGetShortcutEx | _FilePropertiesDialog | I/O Port Functions | File(s) Drag & Drop | _RunWithReducedPrivileges | _ShellExecuteWithReducedPrivileges | _WinAPI_GetSystemInfo | dotNETGetVersions | Drive(s) Power Status | _WinGetDesktopHandle | _StringParseParameters | Screensaver, Sleep, Desktop Lock Disable | Full-Screen Crash Recovery Wrappers/Modifications of others' contributions: _DOSWildcardsToPCRegEx (original code: RobSaunder's) | WinGetAltTabWinList (original: Authenticity) UDF's added support/programming to: _ExplorerWinGetSelectedItems | MIDIEx UDF (original code: eynstyne) (All personal code/wrappers centrally located at Ascend4nt's AutoIT Code)
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now