-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvienna-to-yojimbo-archive.scpt
67 lines (58 loc) · 2.27 KB
/
vienna-to-yojimbo-archive.scpt
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
(*
Create Yojimbo Web Archive From Vienna
Justin Reese, 3 November 2009
http://justinreese.com/vienna-to-yojimbo-applescripts
Based entirely on this script by John Gruber, who deserves most of the credit:
http://daringfireball.net/misc/2007/05/nnw-to-yojimbo-web-archive
Which in turn was based heavily on a script by Fraser Speirs that is no longer online.
Usage: When invoked, a new Yojimbo web archive will be created based on
the currently selected headline in Vienna. The script prompts
for tags, which must be separated by ", " — that is, comma-space.
*)
tell application "GrowlHelperApp"
set the allNotificationsList to {"Success Notification", "Failure Notification"}
set the enabledNotificationsList to {"Success Notification", "Failure Notification"}
register as application ¬
"Vienna to Yojimbo Script" all notifications allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Vienna"
end tell
tell application "Vienna"
try
if exists current article then
set selectedArticle to the current article
set selectedArticleURL to the link of selectedArticle
set selectedArticleTitle to the title of selectedArticle
-- prompt for tags
set _tags to {}
try
display dialog "Tags:" default answer ""
set _answer to text returned of result
if _answer is not "" then
set AppleScript's text item delimiters to ", "
set _tags to text items of _answer
end if
end try
tell application "Yojimbo"
set _new_item to (make new web archive item with contents selectedArticleURL)
set name of _new_item to selectedArticleTitle
add tags _tags to _new_item
end tell
tell application "GrowlHelperApp"
notify with name ¬
"Success Notification" title ¬
"Import Success" description "Successfully archived \"" & selectedArticleTitle & ¬
"\" into Yojimbo." application name "Vienna to Yojimbo Script"
end tell
else
error "No headline is selected."
end if
on error error_message number error_number
tell application "GrowlHelperApp"
notify with name ¬
"Failure Notification" title ¬
"Import Failure" description "Failed to archive article into Yojimbo. Error: " & ¬
error_message application name "Vienna to Yojimbo Script"
end tell
end try
end tell