Newsgroup: it.comp.aiuto
Titolo: Portare un HTML su un TXT

Salve, sono un neofita terra terra....
volevo sapere, se era possibile portare un HTML su un TXT lasciando intatta
la sua formattazione....
una sorta di pagina web senza link e senza immagini in formato txt...
è una cosa fattibile??
ringrazio in anticipo,
iss

 è una cosa fattibile??
Dipende da cosa intendi con 'lasciando intatta la sua formattazione'.
Apri il file html e dal menu file scegli Salva come > File di testo
(.txt)
-- 
Tiziano "Lapalissiano" Marmiroli
Microsoft MVP - Office

 ha scritto nel messaggio
news:7aua00tjeho7o0gbq...@4ax.com...

intendo: così come lo vedi in internet, lo devi vedere uguale (anzi, simile)
au un txt....
senza codici, tag o che so io...
iss

 senza codici, tag o che so io...
Hai fatto la prova che ti ho detto?


 è una cosa fattibile??
Hai provato a File salva come >> file di testo (*.txt)  ?
altrimenti dillo che ti posto lo script (*.vbs) di qui sotto
'-- Web-To-Text will convert a webpage to text. Enter the full path of the HTML or HTM file
'-- and click OK. If the file was named, for example, index.html then a file will appear in the
'-- same folder called index.txt. The URL text of links can be included or not.
'--**the script starts by asking whether you want to save URL text. That means that any links
'--    in the page will also include the URL, written as :  url - link text. ex.: http:\\
www.yahoo.com
 - Go To Yahoo
'--**Next the script gets the file and reads it into a textstream (stripit sub).
'--**stripit goes through from one tag to the next, getting the text between them.
'--    If it finds a link tag (HREF=) it can also get the URL from that and insert it ahead of the link text seen on the webpage.
'-- **The file without tags is then written to a temp file (to avoid the confusion
of a finished file appearing before processing is done).
'-- ** Next the temp file is read into a string, one line at a time, dropping out lines that have only spaces.
'--      (there are sometimes many empty lines when the tags are removed.)
'--**  Finally, character codes such as &nbsp; are converted and the finished string is written to the final text file.
'--     the temp file is deleted and a message box informs that the process is finished.
'---------------------------------------------------------------------
--
Fosco

 altrimenti dillo che ti posto lo script (*.vbs) di qui sotto
puoi provare a metterlo??
cosě provo un po'....
ti ringrazio
iss

"issproevolution"
'abbi pazienza fino a che esce il messagbox "all done"
' l'output sara' directory del vbs nomefile.txt
Dim fso, fname, fpath, fdot, tpath, s1, s2, boolurl, r, f1
Set fso = CreateObject("Scripting.FileSystemObject")
on error resume next
tpath = fso.GetSpecialFolder(2) '--get temp folder path
fname = inputbox("Enter the path of the file", "Filepath")
if fname = "" then
  set fso = nothing
  wscript.quit
end if
  if fso.fileexists(fname) = false then
      msgbox "There's no such file.", 16, "Woops!"
      set fso = nothing
      wscript.quit
  end if
 fdot = instrrev(fname, ".")
  fpath = left(fname, fdot)
  '---------------find out whether to save url text for links.
 r = msgbox("If this file contains links , the link URL text"& _
 "can beincluded in the new file. ", 36, "Save Link URLs?")
   if r = 6 then
       boolurl = true
  else
       boolurl = false
  end if
  call stripit(fname, tpath) 'first take out all tags and save in TEMP.
   set f1 = fso.OpenTextFile(tpath & "\temphtml.txt", 1)
  do while f1.AtEndOfStream = false
       s1 = f1.ReadLine
        if s1 <> "" then  '-take out space left by stripping HTML
           s2 = s2 & s1 & vbcrlf
        end if
         if f1.AtEndOfStream = true then
           exit do
         end if
   loop
  f1.Close
 set f1 = nothing   '--s2 is now the file with empty lines removed
  s2 = Replace(s2, chr(38) & "nbsp;", " ", 1, -1, 1)
  s2 = Replace(s2, chr(38) & "quot;", chr(34), 1, -1, 1)
  s2 = Replace(s2, chr(38) & "amp;", chr(38), 1, -1, 1)
  s2 = Replace(s2, chr(38) & "gt;", ">", 1, -1, 1)
  s2 = Replace(s2, chr(38) & "lt;", "<", 1, -1, 1)
  s2 = Replace(s2, chr(38) & "#160;", " ", 1, -1, 1)
  s2 = Replace(s2, chr(38) & "#33;", "!", 1, -1, 1)
 set f1 = fso.createTextFile(fpath & "txt", true)  '-write the new file
 f1.Write s2
 f1.Close
set f1 = nothing
fso.deletefile tpath & "\temphtml.txt", true '--delete temp file.
set fso = nothing
 msgbox "All done.", 0, "done"
'---------------------------------------------------------------------------------
'---------------------------------------------------------------------------------
sub stripit(sfil1, tpath1) '------sub to strip HTML tags.
 dim rb, lb, s, lt, sb, srb, slb, stag, atag, sp, f, sfil
   set f = fso.opentextfile(sfil1, 1)
    sfil = f.readall
    f.close
  set f = nothing
  set f = fso.createtextfile(tpath1 & "\temphtml.txt", true)
   sb = 1
   rb = 1
   lt = len(sfil)
   do while rb <> 0
      rb = instr(sb, sfil, ">", 1)   '-find > tag. sb is the last < tag.
         if rb = 0 or rb >= lt then
             exit do
        end if
      lb = instr(rb, sfil, "<", 1)  '----this finds the next < tag.
         if lb = 0 or lb >= lt then
           exit do
         end if
   '-------------------get url text if that option chosen.
           if boolurl = true then
              stag = mid(sfil, sb, (rb - sb))
              if stag <> "" then
                   atag = instr(1, stag, "HREF=", 1)
                       if atag <> 0 then  '---if it's a link tag then....
                          atag = atag + 6
                           sp = instr(atag, stag, chr(34), 1)
                           stag = mid(stag, atag, (sp - atag)) 'get the link url
                           f.Write stag & " - " 'and write it in the new file.
                       end if
                end if
            end if
  '------------------------------------------------
   If (lb - (rb + 1)) > 0 then 'if there's any text between tags write it to file.
             s = mid(sfil, (rb + 1), (lb - (rb + 1)))
             f.write s
          end if
      sb = lb
       if sb > (lt - 2) then
             exit do
       end if
   loop
f.close
 set f = nothing
 end sub
'Copia incolla su notepad e salva con estensione .vbs
'tutti i file (*.*)  poi ci clicchi sopra. (per esempio Html_to_Txt.vbs)
--
Fosco