| From: James Webster | Date Sent: 2007-01-10 03:46:01 |
| Subject: Finding existing web archive items in Yojimbo 1.4 via AppleScript | To: Yojimbo Talk |
| Navigation: First Message | Previous Message | Next Message | Last Message | |
Hello,
I am working on my own variant of a del.icio.us import AppleScript
into Yojimbo, using the extended scripting features of the latest
version. I am trying to identify if a web archive already exists for
a given URL using the following...
set post_description to "Some description"
set post_url to "http://someurl"
tell application "Yojimbo"
if not (exists web archive item post_description) and not (exists
web archive item post_url) then
make new web archive item with contents post_url
end if
end tell
The above fragment is actually in a loop where my various del.icio.us
posts are retrieved, etc. I find it works brilliantly the first time,
importing all my existing del.icio.us bookmarks as web archives.
However, the second time I run it, it incorrectly identifies about a
quarter of the bookmarks as not already existing, hence duplicates
are created. Subsequent runs also fail to correctly identify URLs/
descriptions that have already been imported.
It is unclear from the Yojimbo AppleScript dictionary exactly which
field of a web archive item the 'exists' operator matches again,
although maybe this can be defined. It is my first attempt at a
largish AppleScript so I might have gotten something wrong (FYI, I am
otherwise an experienced Java developer).
Cheers,
James W.
--
James Webster SA Fin
blog: http://www.thenewsbeforethenews.com photos: http://flickr.com/
photos/jim
| From: Jim Correia | Date Sent: 2007-01-10 03:59:54 |
| Subject: Re: Finding existing web archive items in Yojimbo 1.4 via AppleScript | To: Yojimbo Talk |
| Navigation: First Message | Previous Message | Next Message | Last Message | |
On Jan 10, 2007, at 8:45 AM, James Webster wrote:
> It is unclear from the Yojimbo AppleScript dictionary exactly which
> field of a web archive item the 'exists' operator matches again[sic]
Sorry if this is dry and technical, but I want to be precise :-)
Exists test against the existence of the object whose specifier follows.
exists specifier
When you write
exists (web archive item post_description)
the specifier is for a web archive item whose name is
post_description. Later you test again, using the post_url, but I'm
guessing you weren't intending to test the name twice.
If you want to test to see if you have a web archive for that URL,
you need to write a different specifier.
set post_url to "http://www.barebones.com/"
tell application "Yojimbo"
exists (every web archive item whose source URL is post_url)
end tell
Also, beware that the source URL may be normalized as a result of a
redirect when downloading, etc.
Jim
--
----------------------------------------------------------
This message is sent to you because you are subscribed to
the mailing list <yojimbo-talk@[Protected]>.
To unsubscribe, send mail to: <yojimbo-talk-off@[Protected]>
List archives: <http://www.listsearch.com/yojimbotalk.lasso>
Have a feature request, or not sure if the software's working
correctly? Please send mail to: <support@[Protected]>