CODICE
#include <EditConstants.au3>
#include <GuiConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>
Global $Riga_Titolo, $Riga_Background
$Gui = GUICreate ("UHTML Browser", 630, 445)
$Uhtml = GUICtrlCreateEdit ("", 5, 5, 620, 377, $ES_READONLY)
GUICtrlSetData (-1, "UHTLM")
$Link = GUICtrlCreateInput ("http://", 5, 392, 620, 21)
$Internet = GUICtrlCreateButton ("Leggi url", 5, 415, 80, 25)
$Locale = GUICtrlCreateButton ("Apri file...", 90, 415, 80, 25)
GUISetState (@SW_SHOW)
While 1=1
Switch GUIGetMsg ()
Case $GUI_EVENT_CLOSE
If FileExists (@TempDir & "\WebPage.uhtml") Then FileDelete (@TempDir & "\WebPage.uhtml")
Exit
Case $Internet
GUICtrlSetData ($Uhtml, "")
GUICtrlSetData ($Uhtml, _Leggi_UHTML (GUICtrlRead ($Link), 0))
Case $Locale
$Apri_File_Locale = FileOpenDialog ("Apri file", @DesktopDir, "File uhtml (*.uhtml)")
If Not $Apri_File_Locale = "" Then
GUICtrlSetData ($Uhtml, "")
GUICtrlSetData ($Uhtml, _Leggi_UHTML ($Apri_File_Locale, 1))
EndIf
EndSwitch
WEnd
Func _Leggi_UHTML ($Url, $Internet_o_Locale)
Local $i, $lis, $Testo_Finale
If FileExists (@TempDir & "\WebPage.uhtml") Then FileDelete (@TempDir & "\WebPage.uhtml")
$Testo_finale = ""
$Righe_Uhtml = ""
If $Internet_o_Locale = 0 Then
InetGet ($Url, @TempDir & "\WebPage.uhtml")
ElseIf $Internet_o_Locale = 1 Then
FileCopy ($Url, @TempDir & "\WebPage.uhtml")
EndIf
$Lunghezza_File_Uhtml = _FileCountLines(@TempDir & "\WebPage.uhtml")
For $i = 1 To $Lunghezza_File_Uhtml
If StringInStr (FileReadLine (@TempDir & "\WebPage.uhtml" ,$i), "-Title:/") Then $Riga_Titolo = $i
If StringInStr (FileReadLine (@TempDir & "\WebPage.uhtml" ,$i), "-Background_Color:/") Then $Riga_Background = $i
Next
$Leggi_Titolo = FileReadLine (@TempDir & "\WebPage.uhtml", $Riga_Titolo)
$Titolo_Gui = StringReplace ($Leggi_Titolo, "-Title:/", "")
WinSetTitle ($Gui, "", $Titolo_Gui)
$Background = FileReadLine (@TempDir & "\WebPage.uhtml", $Riga_Background)
$Background_Color = StringReplace ($Background, "-Background_Color:/", "")
GUICtrlSetBkColor ($Uhtml, "0x" & $Background_Color)
For $i = 3 To $Lunghezza_File_Uhtml
$Riga_attuale = FileReadLine(@TempDir & "\WebPage.uhtml", $i)
If Not $Riga_attuale = "" Then
If StringInStr ($Riga_attuale, "<hr>") Then
;<hr>
If $Riga_attuale = "<hr>" Then
$Riga_Attuale = StringReplace ($Riga_attuale, "<hr>", "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------")
Else
$Riga_Attuale = StringReplace ($Riga_attuale, "<hr>", @CRLF & "------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------" & @CRLF)
EndIf
$Testo_Finale &= $Riga_attuale & @CRLF
Else
$Testo_Finale &= $Riga_attuale & @CRLF
EndIf
EndIf
Next
FileDelete (@TempDir & "\WebPage.uhtml")
Return $Testo_Finale
EndFunc