Get url "file:///..."

-hh hh at hh.on-rev.com
Tue Jun 21 19:33:01 CEST 2016


Hi all,

the task of Jim is, as I understand, that he wants a correct
actual browser interpretation of the file, that is, what Safari
displays, some say HTMLtoTEXT to such a conversion.
LC's status for 'the htmltext' is HTML of before 2005 ...

The applescript is probably instable because of delayed result
sending/ getting but it's the most actual interpretation you can have.

Now I just looked into my treasure chest for MacOS and found the
following. I tested once for 50 files. Worked stable and very fast.
(This is the conversion method that TextEdit uses).

Hermann

-- DOES NOT CONVERT text that is javascript generated by a browser.
-- Convert files on MacOS, tested on 10.11/ 10.12
-- Outputs to an input-file with the ending changed to format
-- "textutil -convert format <inputfile.format>
-- format is one of the following
-- txt, html or htm, rtf, rtfd, doc, docx, wordml, odt, webarchive

on mouseUp
  set defaultfolder to \
        "/Users/jimhurley/Library/Mail Downloads/elec_web/precincts/"
  put the files into fs
  -- filter fs with/without some criterium
  repeat for each line f in fs
    put shell("textutil -convert txt " & f) into nirwana
  end repeat
end mouseUp

If you have all files and only these in one folder you could simply use:
(all files converted by one line, you could do that also in Terminal).

on mouseUp
  put "/Users/jimhurley/Library/Mail Downloads/elec_web/precincts/" into f0
	-- assuming all files to convert end in "htm"	
  put shell("textutil -convert txt " & f0&"*.htm") into nirwana 
end mouseUp




--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/Get-url-file-tp4705988p4706032.html
Sent from the Revolution - User mailing list archive at Nabble.com.



More information about the use-livecode mailing list