-- Places pasted link on a web page, from where the link may be opened or the file downloaded
-- Written by Stan Cleveland, 2011/12/01
activate
with timeout of 14400 seconds
set theAddress to text returned of (display dialog "Paste the desired web link here:" ¬
default answer "" buttons {"Cancel", "OK"} default button 2 with icon 1)
end timeout
set html to "<!DOCTYPE HTML PUBLIC>
<HTML>
<HEAD>
<TITLE>The Desired Link</TITLE>
</HEAD>
<BODY BGCOLOR=#FFFFFF>
<a href="" & theAddress & "\">" & theAddress & "</a>
</BODY>
</HTML>"
set theDesktop to "" & (path to desktop)
set fileRef to open for access file (theDesktop & "Temp.html") with write permission
set eof of fileRef to 0
write html to fileRef as «class utf8»
close access fileRef
tell application "Safari"
activate
open file (theDesktop & "Temp.html")
end tell