How to automate exporting of static folder

Users asking other users for AppleScripts that work with Bookends.
Post Reply
Nhaps
Posts: 244
Joined: Mon Sep 26, 2011 10:05 pm

How to automate exporting of static folder

Post by Nhaps »

I am improving my AppleScript to export my static folder to a bib file (LaTeX). But there is one piece missing:

I cannot find a way to make the script select the folder. I was able to ascribe a shortcut to it (manual page 76), but after invoking it the selection reverts back to All references. I am curious to know if there is a way to jump to the sidebar without using the mouse. Otherwise the script won't work.
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: How to automate exporting of static folder

Post by Jon »

We don't provide AppleEvents that manipulate the UI. But you could possibly do this with GUI scripting. Google for many links to this, here's one

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

Jon
Sonny Software
Nhaps
Posts: 244
Joined: Mon Sep 26, 2011 10:05 pm

Re: How to automate exporting of static folder

Post by Nhaps »

Ok, thanks for the link
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: How to automate exporting of static folder

Post by Jon »

BTW, I assume you know the groups that the folder contains. You an easily script exporting the references from each group in that folder.

Jon
Sonny Software
Nhaps
Posts: 244
Joined: Mon Sep 26, 2011 10:05 pm

Re: How to automate exporting of static folder

Post by Nhaps »

Don't recall, will try to look for info about this on the manual
Nhaps
Posts: 244
Joined: Mon Sep 26, 2011 10:05 pm

Re: How to automate exporting of static folder

Post by Nhaps »

Here is an updated script for those wanting to export folder references to a bib file quickly. This is for LaTeX users:

1. First choose your destination for the bib file in Biblio -> Bibliography
2. Ascribe a shortcut for your static folder (in the script mine is comm+1)
3. Type the name of your static folder into the script
4. Within All references, select the reference you want to copy to your static folder
5. Run the script below: it will copy your last reference to the static folder, then it will update everything to the bib file.

Run this script:

Code: Select all

tell application "Bookends"
	activate
	delay 1
end tell

tell application "System Events"
	tell process "Bookends"
		keystroke "1" using (command down)
		delay 1
		key code 123 using {control down, option down, command down}
		delay 2
		keystroke "TYPE HERE THE NAME OF YOUR STATIC FOLDER"
		delay 1
		keystroke "h" using {option down, shift down, command down}
		delay 1
		keystroke "a" using {option down, shift down, command down}
		delay 1
	end tell
end tell

tell application "System Events"
	tell process "Bookends"
		keystroke "b" using {shift down, command down}
		delay 1
		keystroke return
		delay 1
		keystroke return
		delay 1
		keystroke "r" using {command down}
		delay 1
	end tell
end tell
naupaka
Posts: 6
Joined: Fri Mar 17, 2017 7:39 pm

Re: How to automate exporting of static folder

Post by naupaka »

Just made a post with a different script here: viewtopic.php?f=2&t=4105&p=19158#p19158
Nhaps
Posts: 244
Joined: Mon Sep 26, 2011 10:05 pm

Re: How to automate exporting of static folder

Post by Nhaps »

I have produced a more streamlined macro, this time with Keyboard Maestro 8. This is better than my Apple Script above. There are two things you have to do: 1) assign a folder destination in Biblio - Bibliography; 2) Change name of static folder, in this case "Thesis".

This thing works like magic, saves time!
Attachments
Screen Shot 2017-09-28 at 9.22.32 PM.png
Screen Shot 2017-09-28 at 9.22.32 PM.png (136.62 KiB) Viewed 19508 times
Dellu
Posts: 268
Joined: Sun Mar 27, 2016 5:30 am

Re: How to automate exporting of static folder

Post by Dellu »

Nhaps wrote: Thu Sep 28, 2017 10:06 pm I have produced a more streamlined macro, this time with Keyboard Maestro 8. This is better than my Apple Script above. There are two things you have to do: 1) assign a folder destination in Biblio - Bibliography; 2) Change name of static folder, in this case "Thesis".

This thing works like magic, saves time!
Hi Nhaps,
are u still using this script?
I was looking for a similar solution that can run regularly to export recently modified references (using Keyboard Maestro)-
Jon
Site Admin
Posts: 10048
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: How to automate exporting of static folder

Post by Jon »

These scripts were written before Bookends had an AppleScript dictionary and true AS support. You can now access the contents of a group directly without bothering with the UI.

Jon
Sonny Software
Post Reply