Cyber Posted September 7, 2007 Posted September 7, 2007 Hi! Can you help me please? I need a function that convert HTML in Easy text Exist? Thanks Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key
ValeryVal Posted September 7, 2007 Posted September 7, 2007 May be this script can help you expandcollapse popup$FilesString = FileOpenDialog( "Choose a folder", @ScriptDir, "HTML files (*.html)", 1+2) if $FilesString = "" then exit $Files = StringSplit($FilesString, "|") $filename = $Files[$Files[0]] ConvertAndWrite($filename) exit func ConvertAndWrite($FileName) local $OldFile, $NewFile, $Line $OldFile = FileOpen ($FileName, 0) $NewFile = FileOpen ($FileName & ".txt", 1) $Content = FileRead($OldFile) $Content = StringStripCr($Content) If not @error Then ; Strip Head $Content = StringRegExpReplace($Content, '<head>(.|\n)+?</head>','') $Content = StringRegExpReplace($Content, '<script>(.|\n)+?</script>','') $Content = StringRegExpReplace($Content, '<(.|\n)+?>','') ; Replace HTML abbrev. $Content = StringReplace($Content, '<','<') $Content = StringReplace($Content, '>','>') $Content = StringReplace($Content, ' ',' ') $Content = StringReplace($Content, '©','©') ; Replace Tab to space $Content = StringReplace($Content, '\r',' ') ; Strip double spaces while StringInStr($Content,' ') $Content = StringReplace($Content, ' ',' ') wend ; Replace space + @Lf lines $Content = StringReplace($Content, ' ' & @Lf,@Lf) ; Strip empty lines while StringInStr($Content,@Lf & @Lf) $Content = StringReplace($Content, @Lf & @Lf, @Lf) wend ; Now you can write text FileWrite($NewFile, $Content) endif FileClose($OldFile) FileClose($NewFile) endfunc The point of world view
ValeryVal Posted September 7, 2007 Posted September 7, 2007 Some fixes: Replace $FilesString = FileOpenDialog( "Choose a folder", @ScriptDir, "HTML or XML files (*.html)", 1+2) to $FilesString = FileOpenDialog( "Choose a folder", @ScriptDir, "HTML files (*.html;*.htm)", 1+2) And add line $Content = StringReplace($Content, '"','"') after line $Content = StringReplace($Content, '©','©') The point of world view
Moderators big_daddy Posted September 7, 2007 Moderators Posted September 7, 2007 Here's a working example. #include <IE.au3> $sHTML = "" $sHTML &= "<HTML>" & @CR $sHTML &= "<HEAD>" & @CR $sHTML &= "<TITLE>HTML Test Page</TITLE>" & @CR $sHTML &= "</HEAD>" & @CR $sHTML &= "<BODY>" & @CR $sHTML &= "<h1>Here is some text within HTML tags.</h1>" & @CR $sHTML &= "Some more text." & @CR $sHTML &= "<p> " & @CR $sHTML &= "I think we have accomplished our goal!" & @CR $sHTML &= "</BODY>" & @CR $sHTML &= "</HTML>" $oIE = _IECreate() _IEDocWriteHTML($oIE, $sHTML) ConsoleWrite(_IEBodyReadText($oIE) & @CR)
Cyber Posted September 7, 2007 Author Posted September 7, 2007 fantastic! Thanks!! Console Browse: Navigate on the WEB in a textual consoleMultiPing!: Show computer on the lan and/or show the local/remote task, ALL animated!KillaWin: Event executingCryptPage: Crypt your webpage and show only with key
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