• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Need Applescript to Auto-populate 'File Info' Metadata in INDD CC and exported PDFs

Explorer ,
Apr 20, 2017 Apr 20, 2017

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

TOPICS
Scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Apr 24, 2017 Apr 24, 2017

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.

  1. -- version independent approach
  2. tell application id "com.adobe.indesign"
  3.   set username to user name -- of application
  4.   tell active document
  5.     set docu
...

Votes

Translate

Translate
Guide ,
Apr 21, 2017 Apr 21, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 21, 2017 Apr 21, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 24, 2017 Apr 24, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guide ,
Apr 24, 2017 Apr 24, 2017

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.

  1. -- version independent approach
  2. tell application id "com.adobe.indesign"
  3.   set username to user name -- of application
  4.   tell active document
  5.     set document title of metadata preferences to name
  6.     set author of metadata preferences to username
  7.     save
  8.   end tell
  9. end tell

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 24, 2017 Apr 24, 2017

Copy link to clipboard

Copied

LATEST

Perfect! I'll updated the script to what you have above and give it a whirl. Again, i sincerely appreciate your quick response.

~bexterinni

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines