-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathSafari URL Session.applescript
More file actions
executable file
·35 lines (31 loc) · 1.07 KB
/
Safari URL Session.applescript
File metadata and controls
executable file
·35 lines (31 loc) · 1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
property _template : "<li><a href=\"%url\">%name</a></li>"
--search and replace function for template
on snr(tofind, toreplace, TheString)
set ditd to text item delimiters
set text item delimiters to tofind
set textItems to text items of TheString
set text item delimiters to toreplace
if (class of TheString is string) then
set res to textItems as string
else -- if (class of TheString is Unicode text) then
set res to textItems as Unicode text
end if
set text item delimiters to ditd
return res
end snr
set prettyDate to do shell script "date '+%A, %B %d, %Y at %l:%M %p'"
set theTitle to "Bookmarks " & prettyDate
set urlList to "<ul>"
tell application "Safari"
set tabList to every tab of front window
repeat with aTab in tabList
set aLink to _template
set aLink to my snr("%name", name of aTab, aLink)
set aLink to my snr("%url", URL of aTab, aLink)
set urlList to urlList & aLink & return
end repeat
end tell
set urlList to urlList & "</ul>"
tell application "Evernote"
set theNote to create note with html urlList title theTitle notebook "Bookmarks"
end tell