Feature Request: Modifications to Improve Renaming

A place for users to ask each other questions, make suggestions, and discuss Bookends.
Post Reply
DrJJWMac
Posts: 348
Joined: Sat Jun 22, 2019 8:04 am
Location: Alabama USA

Feature Request: Modifications to Improve Renaming

Post by DrJJWMac »

I am restructuring an AppleScript that copies attachments into a sub-folder under the Attachments folder. In doing this, I realized why I had to rename the attachment after it was copied. To identify an attachment, Bookends flattens the Attachments folder and parses the list. It does not distinguish these three PDF files ...

Attachments (folder)
- SomePDF.pdf
- Library 1 (sub-folder)
-- SomePDF.pdf
- Library 2 (sub-folder)
-- SomePDF.pdf

I have a way to do this by prefixing the filename with the name for the attachments folder. The result is

Attachments (folder)
- SomePDF.pdf
- Library 1 (sub-folder)
-- Library 1 SomePDF.pdf
- Library 2 (sub-folder)
-- Library 2 SomePDF.pdf

I have one request as a result of my explorations. Can Bookends provide an AppleScript command "rename attachment using format (format name)". This will allow me (and others) to employ the power and flexibility built into Bookends rather than rolling my own fixed renaming code. If not, I will continue instead as below.

My AppleScript will put the window name into field U20. My AppleScript renaming will mimic manual renaming using format with u20 d - a. But ...

I make note of a confusion in the Format Manager inputs. Under Special Characters, the command ! (exclamation point) is given as a way to input the Database name. In truth, it inputs the full Database path. I'd prefer that ! would input only the Database NAME (as appears in the bibliography window), not the full path to the database. In the format manager for my renaming format, I could instead use ! d - a rather than u20 d - a, and I will not have to rely on running my AppleScript to populate the U20 field prior to manually adding attachments and/or re-running to rename the attachment after it is attached.

Summary
--
* Have an AppleScript command to rename an attachment using a specific format
* Have ! insert only the NAME for the database (the name for the frontmost window) not the full path to the database file

I hope this is clear enough to follow.
--
JJW
Jon
Site Admin
Posts: 10070
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Feature Request: Modifications to Improve Renaming

Post by Jon »

This can be done right now with the existing AS dictionary. Maybe you are doing this now, I'm not sure, but these are the steps: Get database name and the PDF path from Bookends create the new name accordingly. Or create a format and have it return the new PDF name. Then tell the Finder to rename the PDF (you have the full path) and change it in the Bookends database (by getting and setting the Attachments field).

As to getting the library's path, I can't reproduce that issue with ! in a format (I tried Bookends 14.0.4 and the just-released 14.0.8). In my hands it outputs just the database name, not the full path. If I'm understanding you correctly, and this is not what you see, please contact tech support with an example format and a screen snap of what it outputs for you.

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

Re: Feature Request: Modifications to Improve Renaming

Post by DrJJWMac »

Apologies. My issue is that ! generates a name with the file extension, not that it generates the full path. I would prefer that ! returns "My Library" rather than "My Library.bdb".

I have an update in progress to my AppleScript method to copy files into a subfolder. The issue from above carries over. I specifically have to populate the user20 field with just the library name (not the database name + database file extension) as I do the copy operation. This adds extra friction / overhead on the administration in splitting attachments for libraries into their own sub-folder.

Let me provide a specific example. Suppose that I have a library called My Library 1. Suppose that I have generated a sub-folder called My Library 1 to store attachments. Suppose that I want to copy attachments into the sub-folder and have them uniquely named *without using the BE method to suffix the name with an ID*. Essentially, I have to live with one or the other of these two options.

Option 1
-- as I copy over the file, prefix it with My Library 1.bdb
-- prefix the renaming format (in the Formats Manger) with "! " (I would use "! d - a")

Option 2
- parse the Library name to remove the file extension ".bdb"
- as I copy over the file, prefix it with My Library 1
- put the library name My Library 1 into user20
- prefix the renaming format (in the Formats Manager) with "u20 " (I would use "u20 d - a")

The disadvantage of option 1 is the clutter in the attachment name having the file extension.

The disadvantage of option 2 is that user20 remains blank until I run the AppleScript, so I have to remember to populate user20 and then re-run the "Rename Attachments" context menu.

Summary
--
Please consider a change to make "!" return the library name without the extension ".bdb".
--
JJW
Jon
Site Admin
Posts: 10070
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Feature Request: Modifications to Improve Renaming

Post by Jon »

I don't see any disadvantage to removing the library's extension when outputting it in the formatter. I'll do that.

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

Re: Feature Request: Modifications to Improve Renaming

Post by DrJJWMac »

Thank you. This change will make the steps to generate a self-contained library with its own attachments sub-folder significantly easier.
--
JJW
Jon
Site Admin
Posts: 10070
Joined: Tue Jul 13, 2004 6:27 pm
Location: Bethesda, MD
Contact:

Re: Feature Request: Modifications to Improve Renaming

Post by Jon »

If you need this sooner rather than later, please write to tech support and I'll give you access to a beta build.

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

Re: Feature Request: Modifications to Improve Renaming

Post by DrJJWMac »

No worries. I can wait. Thanks.
--
JJW
Post Reply