maniootek Posted March 31, 2022 Share Posted March 31, 2022 Is there a way to show parsed html code in default browser but not using any IE functions and not saving a html file? I want show parsed html code in my default browser Chrome in new tab. Code will be stored in string variable like $HtmlCode = '<h1>Test</h1><p style="color:red">This is some text</p>' Link to comment Share on other sites More sharing options...
Developers Jos Posted March 31, 2022 Developers Share Posted March 31, 2022 Moved to the appropriate AutoIt General Help and Support forum, as the AutoIt Example Scripts forum very clearly states: Quote Share your cool AutoIt scripts, UDFs and applications with others. Do not post general support questions here, instead use the AutoIt Help and Support forums. Moderation Team SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Nine Posted March 31, 2022 Share Posted March 31, 2022 In my sense, the easiest way with WebDriver is to save your HTML string to a temp file (FileWrite), create a new tab (_WD_NewTab), load the file (_WD_Navigate), and delete the file right after (FileDelete) “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
Danp2 Posted March 31, 2022 Share Posted March 31, 2022 With WebDriver, you could likely avoid the temp file by passing the HTML as a parameter to _WD_ExecuteScript and use javascript to write the HTML directly to the browser. Without WebDriver, I would simply write the HTML to a temp file and then launch it with ShellExecute(). MarkIT 1 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Popular Post Danyfirex Posted March 31, 2022 Popular Post Share Posted March 31, 2022 You could do this: _DefaultBroswerLoadPage() Func _DefaultBroswerLoadPage() Local $sUrl = "http://localhost:80" TCPStartup() $iMainSocket = TCPListen("127.0.0.1", 80) ShellExecute($sUrl) Local $iConnectedSocket = -1 Local $hTimer = TimerInit() Local $bErrorTimeout = False Do Sleep(300) $iConnectedSocket = TCPAccept($iMainSocket) If TimerDiff($hTimer) > (1000 * 5) Then $bErrorTimeout = True ExitLoop EndIf Until $iConnectedSocket <> -1 If $bErrorTimeout Then TCPShutdown() Return "" EndIf Local $sReceived = TCPRecv($iConnectedSocket, 1024) ;~ $sReceived = BinaryToString($sReceived, 4) TCPSend($iConnectedSocket, '<h1 style="text-align: center;color: blue;font-size: 40px;">AutoIt Rocks</h1><p style="color: red; font-size: 30px;text-align: center;">@AutoItVersion: ' & @AutoItVersion & '<br><br>' & "@AutoItPID: " & @AutoItPID & '</p>') If $iConnectedSocket <> -1 Then TCPCloseSocket($iConnectedSocket) TCPShutdown() EndFunc ;==>_DefaultBroswerLoadPage Saludos jugador, genius257, Danp2 and 5 others 8 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
maniootek Posted March 31, 2022 Author Share Posted March 31, 2022 2 hours ago, Danyfirex said: You could do this: _DefaultBroswerLoadPage() Func _DefaultBroswerLoadPage() Local $sUrl = "http://localhost:80" TCPStartup() $iMainSocket = TCPListen("127.0.0.1", 80) ShellExecute($sUrl) Local $iConnectedSocket = -1 Local $hTimer = TimerInit() Local $bErrorTimeout = False Do Sleep(300) $iConnectedSocket = TCPAccept($iMainSocket) If TimerDiff($hTimer) > (1000 * 5) Then $bErrorTimeout = True ExitLoop EndIf Until $iConnectedSocket <> -1 If $bErrorTimeout Then TCPShutdown() Return "" EndIf Local $sReceived = TCPRecv($iConnectedSocket, 1024) ;~ $sReceived = BinaryToString($sReceived, 4) TCPSend($iConnectedSocket, '<h1 style="text-align: center;color: blue;font-size: 40px;">AutoIt Rocks</h1><p style="color: red; font-size: 30px;text-align: center;">@AutoItVersion: ' & @AutoItVersion & '<br><br>' & "@AutoItPID: " & @AutoItPID & '</p>') If $iConnectedSocket <> -1 Then TCPCloseSocket($iConnectedSocket) TCPShutdown() EndFunc ;==>_DefaultBroswerLoadPage Saludos you are master Danyfirex 1 Link to comment Share on other sites More sharing options...
Gianni Posted March 31, 2022 Share Posted March 31, 2022 @Danyfirex that's very nice 👍. Bravo! _DefaultBroswerLoadPage() Func _DefaultBroswerLoadPage() Local $sUrl = "http://localhost:80" TCPStartup() $iMainSocket = TCPListen("127.0.0.1", 80) ShellExecute($sUrl) Local $iConnectedSocket = -1 Local $hTimer = TimerInit() Local $bErrorTimeout = False Do Sleep(300) $iConnectedSocket = TCPAccept($iMainSocket) If TimerDiff($hTimer) > (1000 * 5) Then $bErrorTimeout = True ExitLoop EndIf Until $iConnectedSocket <> -1 If $bErrorTimeout Then TCPShutdown() Return "" EndIf Local $sReceived = TCPRecv($iConnectedSocket, 1024) ;~ $sReceived = BinaryToString($sReceived, 4) TCPSend($iConnectedSocket, '<h1 style="text-align: center;color: blue;font-size: 40px;">AutoIt Rocks</h1><p style="color: red; font-size: 30px;text-align: center;">@AutoItVersion: ' & _ @AutoItVersion & '<br> <img src="https://www.autoitscript.com/forum/uploads/monthly_2019_01/1.thumb.jpg.4e910845fcf6cc195122be1deb540735.jpg" width="100" height="100"> <br>' & _ "@AutoItPID: " & @AutoItPID & '</p>') If $iConnectedSocket <> -1 Then TCPCloseSocket($iConnectedSocket) TCPShutdown() EndFunc ;==>_DefaultBroswerLoadPage Danyfirex 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
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