Page 1 of 1

Chance of AppleScript support expanding (or alternatives)

Posted: Thu May 01, 2014 10:41 pm
by ghoetker
Enjoying Bookends very much so far. One (the only??) advantage EndNote offers is really good AppleScriptability. I know that BE can respond to AppleScript requests to provide information. Several scripts I use regularly, however, need a bit more scriptability. In particular, it would be great to be able to set the value of fields programatically. For example, a script I use to keep Mavericks Finder tags and EN (or BE) keywords harmonized includes the lines:

Code: Select all

tell application "EndNote"
	set myFile to first document
	set selectedRecords to retrieve "selected" records in myFile
	repeat with theRecord in selectedRecords
            set keyWords to field "Keywords" of record theRecord
            -- Stuff
            set field "Keywords" of record theRecord to combinedTerms as text -- <<< Line I can't figure out how to do
        end repeat
end tell
I think I could duplicate everything except the second to last line (set field "Keywords"...) in Bookends, although perhaps not as cleanly as in EndNotes. So, that leads to two questions:

1. Is there any thought of this level of AppleScriptabilty being added to Bookends?
2. Can anyone point me to an alternative way to modify the content of a field programmatically?

Thanks.

Re: Chance of AppleScript support expanding (or alternatives

Posted: Fri May 02, 2014 7:42 am
by Jon
We're always adding features and improving Bookends, and I'd certainly consider expanded AppleScript support, where it makes sense. Having the ability to set the contents of a field is an interesting idea. I'll think about how that. As for modifying the contents of a field programatically -- I haven't looked into this at all, but I wonder if it could be done with AppleScript GUI scripting.

http://www.macosxautomation.com/applesc ... scripting/

Jon
Sonny Software

Re: Chance of AppleScript support expanding (or alternatives

Posted: Fri May 02, 2014 12:35 pm
by ghoetker
That's awesome to hear. Your responsiveness is one of the main reasons I went ahead and purchased Bookends today.

My original message was a bit clumsy in describing "modifying" field values. In fact, what I've normally done is

Code: Select all

set theKeyWords to field "Keywords" of record thisRecord	
set theNewKeyWords to (some manipulation of the variable, theKeyWords, using AppleScript commands unrelated to EndNote)
set field "Keywords" of record thisRecord to theNewKeyWords
So, it's actually just retrieving and setting field values that the bibliographic program has to handle, rather than modifying them programatically. EN does, I think, allow modification such as

Code: Select all

Set end of field "Keywords" of record thisRecord to "a new keyword"
But that's really just a convenience for something that retrieve/manipulate with other AS/set can do equally well.

Thanks for the suggestion of GUI scripting. I've resorted to that in some cases, but generally find it too painful to be worth it.

Much appreciation for considering the addition of this functionality.

Re: Chance of AppleScript support expanding (or alternatives

Posted: Sat May 03, 2014 9:45 am
by edward
Jon wrote:We're always adding features and improving Bookends, and I'd certainly consider expanded AppleScript support, where it makes sense. Having the ability to set the contents of a field is an interesting idea. I'll think about how that. As for modifying the contents of a field programatically -- I haven't looked into this at all, but I wonder if it could be done with AppleScript GUI scripting.
I'd also love to see expanded Applescript support. The existing AS support allows you to get info from the database, but it would be great to be able to add data to records. For example, I'd like to be able to run a script which asks me which which reference I want to modify, then allows me to add a keyword to that record.

I'm 99.9% sure that no amount of GUI scripting will be able to do this reliably. Just run the UIElementInspector.app which is part of the XCode Development tools, move the crosshairs around the various Bookends fields and you will see what I mean.

Re: Chance of AppleScript support expanding (or alternatives

Posted: Sat May 03, 2014 5:07 pm
by Jon
Yes, I think that the ability to change a field externally is probably a good feature to add.

Jon
Sonny Software

Re: Chance of AppleScript support expanding (or alternatives

Posted: Sun May 04, 2014 5:27 am
by NilsMS
Jon wrote:Yes, I think that the ability to change a field externally is probably a good feature to add.
That would be really awesome, as it is this ability which is still missing in my script for linking Devonthink Pro and Bookends (viewtopic.php?f=6&t=3454).

Nils

Re: Chance of AppleScript support expanding (or alternatives

Posted: Sun May 04, 2014 8:46 am
by Jon
I've added the ability to set a field's contents via an AppleScript to Bookends 12.2. Combined with the existing ability to get a field's contents, you can get an existing field (e.g. keywords) and add or delete terms as you like.

Jon
Sonny Software

Re: Chance of AppleScript support expanding (or alternatives

Posted: Sun May 04, 2014 5:21 pm
by edward
Great! Thanks, Jon.