set prefix to "<a href="">
set suffix to ">"
set closetag to "</a>"
do shell script "touch /Users/joshua/Sites/demo/articles.html"
set this_file to "Macintosh HD:Users:joshua:Sites:demo:articles.html"
open for access this_file with write permission
repeat with i from 1 to count of filelist
set docname to item i of filelist
set item_a to (a reference to prefix and docname and suffix and docname and closetag)
my WriteNow(item_a, this_file, true, text)
end repeat
close access file this_file
end run
on WriteNow(this_data, this_file, append_data, MyFormat)
try
set this_file to this_file as string
if append_data is false then
set eof of file this_file to 0
set MyAppend to false
else
set MyAppend to true
end if
if MyFormat is text then
write this_data to alias this_file starting at eof
log " I wrote it as text " & MyAppend & " " & return & this_data & return & return
return true
else
if MyFormat is not text then
write this_data to alias this_file as «class utf8» starting at eof
log " I wrote it as utf8 " & MyAppend & " " & return & this_data & return & return
return true
end if
end if
on error
try
close access file this_file
beep 12
end try
return false
end try
end WriteNow
Joshua Whalen