Skip to main content
Participant
October 4, 2017
Answered

Autofill metadata title with file name, but without extension

  • October 4, 2017
  • 1 reply
  • 1369 views

I found a script that will let me autofill the InDesign document metadata with the file name, but it puts in the .indd extension at the end. Is there a way to get the script to leave out the file extension in the metadata title? Here is the script I'm using:

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

And here is what my metadata looks like after I run it. I just don't want the .indd in there. Suggestions?

This topic has been closed for replies.
Correct answer Kasyan Servetsky

I don't have a Mac at hand at the moment so I'd rather translate this into JavaScript:

main();

function main() {

    try {

        var doc = app.activeDocument;

        doc.metadataPreferences.documentTitle = doc.name.replace(/\.indd$/i, "");

    }

    catch(err) {}

}

Anyway, if you want to edit the AS version, you can find a solution via google. For example, here. (note: you should change 3 to 4. -- four characters in the indd extension).

Hope it helps.

— Kas

1 reply

Kasyan Servetsky
Kasyan ServetskyCorrect answer
Legend
October 4, 2017

I don't have a Mac at hand at the moment so I'd rather translate this into JavaScript:

main();

function main() {

    try {

        var doc = app.activeDocument;

        doc.metadataPreferences.documentTitle = doc.name.replace(/\.indd$/i, "");

    }

    catch(err) {}

}

Anyway, if you want to edit the AS version, you can find a solution via google. For example, here. (note: you should change 3 to 4. -- four characters in the indd extension).

Hope it helps.

— Kas

Addie_TMAuthor
Participant
October 4, 2017

Fantastic, thank you!