I was wondering if there is a way to query Bookends concerning the path or location of an attachment for a reference given a UUID number? Maybe something along the lines of return «event ToySRFLD» "$UUID" given string:"?"
If I put "attachment" in the string value I get the title of the entry. But I'd like the full path of the attachment, and sometimes (e.g. when the title contains a colon) the actual name of the attachment differs from the title. In any case, if the info is available in Bookends somewhere it would be great to know. thanks!
AppleScript query path to attachment
Re: AppleScript query path to attachment
In a format, the symbol
m
will tell Bookends to return the attachment file path. So return ref info using a format consisting only of "m" (if that's all you want).
Jon
Sonny Software
m
will tell Bookends to return the attachment file path. So return ref info using a format consisting only of "m" (if that's all you want).
Jon
Sonny Software
Re: AppleScript query path to attachment
Hi Jon,
"m" isn't a field that I can get using "return «event ToySRFLD»" and the Bookends #id in applescript. Is there a different event value I'd use? Or is this just for format editing and not applescript? Thanks.
"m" isn't a field that I can get using "return «event ToySRFLD»" and the Bookends #id in applescript. Is there a different event value I'd use? Or is this just for format editing and not applescript? Thanks.
Re: AppleScript query path to attachment
Yes, you edit the format, not the AppleScript. Bookends can return results formatted any way you like (in this case, having the attachment pathname).
Jon
Sonny Software
Jon
Sonny Software
Re: AppleScript query path to attachment
Right. Finally got it working. For whatever reason, I had to make sure that the output returns without a newline. For posterity I had to do the following (my bash is pretty bad, sorry):
UUID="{query}"
REFNAME=$(/usr/bin/osascript << EOT
tell application "Bookends"
return «event ToySGUID» "$UUID" given «class RRTF»:"false", string:"attachment"
end tell
EOT)
open "$(echo "$REFNAME"|tr -d '\r')"
to get something that would reliably work. But it does! Thanks.
UUID="{query}"
REFNAME=$(/usr/bin/osascript << EOT
tell application "Bookends"
return «event ToySGUID» "$UUID" given «class RRTF»:"false", string:"attachment"
end tell
EOT)
open "$(echo "$REFNAME"|tr -d '\r')"
to get something that would reliably work. But it does! Thanks.