Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Applescript to convert Webloc to HTML?

The title pretty much explains it. Say, if I had a folder of Webloc files, I'd like to convert the whole folder to HTML URL's (something I could upload and view as a list). If Apple script could do this, that would be so amazing.

macbook pro, Mac OS X (10.4.8)

Posted on Jan 18, 2008 12:01 AM

Reply
4 replies

Jan 18, 2008 11:01 AM in response to gnizm

This is pretty primitive, but works here on 10.4.3. Maybe you can improve on it. Save as an application and drop one or more weblocs or filelocs on it. It should make a simple HTML page on the desktop.

Peter B.

--

on open these_items

set linked_URLs to ""

tell application "Finder"
set these_items to sort these_items by name
end tell

repeat with this_item in these_items

tell application "Finder"
set this_item to this_item as text
set item_name to the displayed name of file this_item
end tell

set webloc_text to read file this_item to eof

set ASTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to "<string>"
set webloc_URL to text item 2 of webloc_text
set AppleScript's text item delimiters to "</string>"
set webloc_URL to text item 1 of webloc_URL
set AppleScript's text item delimiters to ASTID

set linked_URL to "<A HREF=" & "\"" & webloc_URL & "\"" & ">" & item_name & "" & return & "
"

set linked_URLs to linked_URLs & linked_URL

end repeat

set page_header to "<HTML>"
set page_footer to "</HTML>"

set output_file to (path to desktop as text) & "webloc_links.html"

try
open for access file output_file with write permission
write page_header & return & linked_URLs & return & page_footer to file output_file starting at 0
close access file output_file
on error
close access file output_file
end try

end open

-----

Jan 19, 2008 10:20 AM in response to None

I am at best an amateur at Applescripting, I am learning. I got errors when I ran the script. Thanks for the effort though.

If I discovering anything interesting, I will report back. If anyone else can contribute, that would be excellent.

This would be a great way to select specific folders in Safari's bookmarks, drag them to desktop, convert those Webloc files to URLs, and upload them to Del.icio.us

Applescript to convert Webloc to HTML?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.