Copy link to clipboard
Copied
I am on a Mac running El Capitan. I am using InDesign CC.
Below is an Applescript that i found online — i installed this, assigned a keyboard shortcut, and it works great:
tell application "Adobe InDesign CC 2017"
tell active document
set document title of metadata preferences to name
--set x to document title of metadata preferences
save
end tell
end tell
I would like for this script to also fill in the "Author" field of the metadata (pulling the info from the file's "User" field), so that the info will be present in exported PDFs. I don't know how to edit this script so that "Author" field would be populated — perhaps it should be a separate Applescript?
Any help or info is greatly appreciated.
~bexterinni
You have to insert a line "save" before my line #7 to match the functionality.
Sorry, I had missed that detail, it is unusual to re-assign the native save action in that way. The typical approach would add some event handler, umpteen lines of code and I don't have an AppleScript example for that anyway. So I suggest we just stick with your approach.
...
- -- version independent approach
- tell application id "com.adobe.indesign"
- set username to user name -- of application
- tell active document
- set docu
Copy link to clipboard
Copied
What do you mean with "the file's User field"? There is a user name property on the application.
-- version independent approach
tell application id "com.adobe.indesign"
set username to user name -- of application
tell active document
set document title of metadata preferences to name
set author of metadata preferences to username
end tell
end tell
Edit: fight forum software's code formatting
Copy link to clipboard
Copied
I'm sorry i wasn't clear, you are right of course, it's an application setting, not file-level setting — I was referring to the field below the "File" dropdown: File >> User that i also wanted populated by the script.
I edited my script to match yours above and it's exactly what i was looking for. Your help is MUCH appreciated!! Thank you!!
~bexterinni
Copy link to clipboard
Copied
Now that i've been using this script for a couple of days, i'm realizing that that when i hit "Cmd+S", the keyboard shortcut does activate and populates the metadata as i wanted, but apparently it is no longer saving my document. When i close the document, even though i've just hit "Cmd+S", i get a popup prompting me "do you want to save changes before closing document?". If i say no, close and reopen, the file has not been saved. So, it's as if my "Cmd+S" shortcut ONLY works to active the script and doesn't actually save my document any more ... Is that how it's supposed to work? I tried deleting it, and re-set it up again, but i'm getting the same results.
~bexterinni
Copy link to clipboard
Copied
You have to insert a line "save" before my line #7 to match the functionality.
Sorry, I had missed that detail, it is unusual to re-assign the native save action in that way. The typical approach would add some event handler, umpteen lines of code and I don't have an AppleScript example for that anyway. So I suggest we just stick with your approach.
- -- version independent approach
- tell application id "com.adobe.indesign"
- set username to user name -- of application
- tell active document
- set document title of metadata preferences to name
- set author of metadata preferences to username
- save
- end tell
- end tell
Copy link to clipboard
Copied
Perfect! I'll updated the script to what you have above and give it a whirl. Again, i sincerely appreciate your quick response.
~bexterinni