Page 1 of 1

How to automate exporting of static folder

Posted: Thu Feb 02, 2017 4:28 pm
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.

Re: How to automate exporting of static folder

Posted: Sat Feb 04, 2017 8:46 am
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

Re: How to automate exporting of static folder

Posted: Sat Feb 04, 2017 11:39 am
by Nhaps
Ok, thanks for the link

Re: How to automate exporting of static folder

Posted: Sat Feb 04, 2017 12:09 pm
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

Re: How to automate exporting of static folder

Posted: Sun Feb 05, 2017 3:36 am
by Nhaps
Don't recall, will try to look for info about this on the manual

Re: How to automate exporting of static folder

Posted: Sun Feb 05, 2017 3:39 am
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

Re: How to automate exporting of static folder

Posted: Sat Mar 18, 2017 6:26 pm
by naupaka
Just made a post with a different script here: viewtopic.php?f=2&t=4105&p=19158#p19158

Re: How to automate exporting of static folder

Posted: Thu Sep 28, 2017 10:06 pm
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!

Re: How to automate exporting of static folder

Posted: Mon Aug 16, 2021 9:23 am
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)-

Re: How to automate exporting of static folder

Posted: Mon Aug 16, 2021 9:35 am
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