File name of extracted notes and annotations

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
atimm
Posts: 19
Joined: Thu Jan 04, 2018 2:44 pm

File name of extracted notes and annotations

Post by atimm »

Is there a way to set the citekey (ideally with a pre-configured prefix or suffix) as the file name for extracted notes and annotations? If this doesn't work out-of-the-box, could it be done through AppleScript? (Just to be clear, I have little to no experience with AppleScript but would struggle through if necessary.) Thanks in advance for any suggestions. This would simplify my workflow between Zotero, Bookends, and Obsidian.
Jon
Site Admin
Posts: 10072
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: File name of extracted notes and annotations

Post by Jon »

What is you workflow? Are you extracting one reference at a time, saving each as an individual markdown file? I think this could be done with AppleScript and UI scripting. DrJJWMac has been active in this regard. You might want to see these threads

viewtopic.php?t=5351&sid=20ece41ddf3ca4 ... b2e7e60699

https://forum.obsidian.md/t/workflow-ex ... dian/57867

I think the basic idea would be to have Bookends generate the markdown text, which the AppleScript would grab and save to disk with a file name you choose. If DrJJWMac doesn't see this thread, I don't think he'd mind if you ping him.

Jon
Sonny Software
DrJJWMac
Posts: 348
Joined: Sat Jun 22, 2019 8:04 am
Location: Alabama USA

Re: File name of extracted notes and annotations

Post by DrJJWMac »

@atimm: I might presume as Jon mentions that you are saving one reference at a time. If so, what I see being possible is this ...

* Preconfigure the Extract Notes and PDF Annotations menu option with all the parameters that you want to have as the default using Selection as the option.
* Use AppleScript to ...
- grab and save the cite key from the current reference selection
- run the Extract Notes and PDF Annotations->Extract Now menu option
---> you get a dialog box to enter the file name ... this is anticipated with a pause in AppleScript
- enter the cite key as the file name (e.g. AppleScript does this)
* Allow you to manually hit the Save or Cancel (or New Folder) button

I might have a moment tomorrow to put an AppleScript together to do the above. If you have Keyboard Maestro installed, all the better, as the script could be directly linked to a button action.
KMButtonPanel.png
KMButtonPanel.png (115.52 KiB) Viewed 5968 times
The button action might be called -> Export As CiteKey.md. You would click it to get extract the current selection to the point of the (Cancel/Save) dialog box where the file name would already be preconfigured.
--
JJW
DrJJWMac
Posts: 348
Joined: Sat Jun 22, 2019 8:04 am
Location: Alabama USA

Re: File name of extracted notes and annotations

Post by DrJJWMac »

Here is a first draft.

Code: Select all

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions

(*
Save CiteKey Markdown
v 2023-09-21
exports notes and PDF attachments from selected publication item
sets the export name to the cite key
*)

on run
	tell application "Bookends"
		activate
		set thePublications to selected publication items of front library window
		set theCiteKey to ((the user1 of item 1 of thePublications) & ".md") as text
		tell application "System Events"
			key code 14 using {command down}
			delay 2
			keystroke theCiteKey
		end tell
	end tell
end run

--
JJW
Post Reply