Und wie baue ich mir meine Linkliste?
by hubi on 12/02/2010set weblocs_in_folder to every paragraph of (do shell script "ls " & (quoted form of POSIX path of (choose folder) & "*.webloc"))
set myurls to {}
set url_texts to {}
repeat with current_webloc in weblocs_in_folder
set myurls to myurls & geturlfromwebloc(current_webloc)
set url_texts to url_texts & ((characters 1 through (-1 * (count of ".webloc") - 1) of (do shell script "basename " & quoted form of current_webloc)) as text)
end repeat
set htmltext to "<ul>"
repeat with i from 1 to count of myurls
set htmltext to htmltext & "<li><a href=\"" & item i of myurls & "\" target=\"_blank\" rel=\"nofollow external\">" & item i of url_texts & "</a></li>"
end repeat
set htmltext to htmltext & "</ul>" as text
set the clipboard to htmltext
on geturlfromwebloc(weblocpath)
set weblocpath to quoted form of ((POSIX path of weblocpath) & "/rsrc")
set cmd to "strings " & weblocpath & " | grep http | sed '/^.http/s//http/' | head -1"
set cmd to cmd as «class utf8»
set weblocurl to do shell script cmd
return weblocurl
end geturlfromwebloc
No comments yet.