Chance of AppleScript support expanding (or alternatives)

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
ghoetker
Posts: 11
Joined: Tue Apr 29, 2014 2:48 pm

Chance of AppleScript support expanding (or alternatives)

Post 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.
Jon
Site Admin
Posts: 10291
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Chance of AppleScript support expanding (or alternatives

Post 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
ghoetker
Posts: 11
Joined: Tue Apr 29, 2014 2:48 pm

Re: Chance of AppleScript support expanding (or alternatives

Post 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.
edward
Posts: 9
Joined: Tue Apr 17, 2012 4:23 pm

Re: Chance of AppleScript support expanding (or alternatives

Post 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.
Jon
Site Admin
Posts: 10291
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Chance of AppleScript support expanding (or alternatives

Post by Jon »

Yes, I think that the ability to change a field externally is probably a good feature to add.

Jon
Sonny Software
NilsMS
Posts: 60
Joined: Mon Sep 16, 2013 10:13 am

Re: Chance of AppleScript support expanding (or alternatives

Post 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
Jon
Site Admin
Posts: 10291
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Chance of AppleScript support expanding (or alternatives

Post 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
edward
Posts: 9
Joined: Tue Apr 17, 2012 4:23 pm

Re: Chance of AppleScript support expanding (or alternatives

Post by edward »

Great! Thanks, Jon.
Post Reply