Perfect web archive script - help needed

24 views
Skip to first unread message

Krzysztof M.

unread,
Mar 10, 2009, 6:01:55 AM3/10/09
to yojimb...@googlegroups.com
Hello,
I've been using this script for a while to store webarchives in YJ,
but I'd like to extend it to has also the possibility to add a comment
to the item (maybe together with the a tag in one dialog box) and also
wrap it up with a growl notification when the import to YJ is done.
Maybe somebody can help me with that or already have this kind of
script.

set res to (display dialog "Add tag to item?" default answer ""
buttons {"No", "Yes"} default button 2)

if button returned of res is "Yes" then
set res to text returned of res
set flg to false
else
set flg to true
end if

tell application "Safari"
set theURL to URL of document 1
set theName to name of document 1
end tell

tell application "Yojimbo"
if flg then
make new web archive item with contents theURL with properties
{name:theName, flagged:flg}
else
set itmID to (make new web archive item with contents theURL with
properties {name:theName, flagged:flg})
add tags res to itmID
end if
end tell

I am not sure about GROWL, but maybe notification might look like that?

on tellGrowl(itmID, theName, theURL) -- the growl notification routine
global growlIsRunning
if growlIsRunning then -- is growl running?
tell application "GrowlHelperApp"
notify with name itmID title theName description theURL application
name appName with sticky
end tell
end if
end tellGrowl

--
Krzysztof M.
Blog: http://my.opera.com/mkrzych

Krzysztof M.

unread,
Mar 10, 2009, 8:43:24 AM3/10/09
to yojimb...@googlegroups.com
I have something like this. But I'd like to add also the comments (or
leave it blank) to the webarchive in the same dialog box as the tag.
How to do it:

(*
Import front Safari tab to the Yojimbo as a webarchive.
Modifications by email:majk...@gmail.com
http://my.opera.com/mkrzych
*)


set res to (display dialog "Add tag to item?" default answer ""
buttons {"No", "Yes"} default button 2)

tell application "GrowlHelperApp"
set the allNotificationsList to {"Success Notification", "Failure
Notification"}
set the enabledNotificationsList to {"Success Notification", "Failure
Notification"}

register as application ¬
"Web archive to Yojimbo Script" all notifications
allNotificationsList ¬
default notifications enabledNotificationsList ¬
icon of application "Yojimbo"
end tell

if button returned of res is "Yes" then
set res to text returned of res
set flg to false
else

set res to "toclean"
set flg to false
end if

tell application "Safari"
set theURL to URL of document 1
set theName to name of document 1
end tell

tell application "Yojimbo"
try


if flg then
make new web archive item with contents theURL with properties
{name:theName}

tell application "GrowlHelperApp"
notify with name ¬
"Success Notification" title "Import Success w/o TAG" description
"Successfully imported \"" & theURL & ¬
"\" to Yojimbo" application name "Web archive to Yojimbo Script"
end tell


else
set itmID to (make new web archive item with contents theURL with
properties {name:theName, flagged:flg})
add tags res to itmID

tell application "GrowlHelperApp"
notify with name ¬
"Success Notification" title "Import Success" description
"Successfully imported \"" & theURL & ¬
"\" to Yojimbo" application name "Web archive to Yojimbo Script"
end tell
end if
on error error_message number error_number
tell application "GrowlHelperApp"
notify with name ¬
"Success Notification" title ¬
"IMPORT FAILED!" description "FAILED to import \"" & theURL & ¬
"\" to Yojimbo. Error: " & error_message application name "Web
archive to Yojimbo Script"
end tell
end try
end tell

rickdude

unread,
Mar 11, 2009, 10:20:25 PM3/11/09
to Yojimbo Talk
Cool stuff. But I notice that entering multiple tags (comma delimited)
results in one long mega-tag. Is there any way of making the script
behave like the Yojimbo bookmarklets, where comma-delimited words
become multiple tags?

On Mar 10, 9:43 pm, "Krzysztof M." <majkr...@gmail.com> wrote:
> I have something like this. But I'd like to add also the comments (or  
> leave it blank) to the webarchive in the same dialog box as the tag.  
> How to do it:
>
> (*
> Import front Safari tab to the Yojimbo as a webarchive.
> Modifications by email:majkr...@gmail.comhttp://my.opera.com/mkrzych
>  smime.p7s
> 2KViewDownload

Krzysztof M.

unread,
Mar 12, 2009, 4:34:16 PM3/12/09
to yojimb...@googlegroups.com
Well, I am not so good at scripts yet. So maybe somebody can help us
to extend this useful script?

> --~--~---------~--~----~------------~-------~--~----~
> You received this message because you are subscribed to the Google
> Groups "Yojimbo Talk" group.
> To post to this group, send email to yojimb...@googlegroups.com
> To unsubscribe from this group, send email to yojimbo-talk...@googlegroups.com
> For more options, visit this group at http://groups.google.com/group/yojimbo-talk?hl=en
> -~----------~----~----~----~------~----~------~--~---

Reply all
Reply to author
Forward
0 new messages