0

How can I get the file path from the selected object in Adobe Indesign?

Edit: I'm using InDesign CS5 (7.0) Object Model

My user should be able to select an object in Indesign (i.e. a linked file object) and then call a script upon it that edits and saves the linked file. (We have hundresds of .ai files linked that are created by buggy software and need to replace wrongly embedded fonts in some of the .ai files.)

I tried things like

var myObj = app.selection[0];
myFilePath = myObj.filePath;
or
myFilePath = myObj.itemLink.assetURL;

and that did not work. How can I get, in terms of object hierarchy, from the current selection to the string that is the filepath. Selection > Story > Link > Path-property?

Thank you in advance! Kind regards, Stefan

oystersauce
  • 43
  • 1
  • 6

1 Answers1

0

myFilePath = myObj.itemLink.filePath;

But you may consider an illustrator script to proceed all the files in one shot.

Loic
  • 2,173
  • 10
  • 13
  • thanks @Loic . unfortunately this doesn't work. if I run this: `var myObj = app.selection[0]; alert(myObj); alert(myObj.itemLink.filePah);` it throws _JavaScript 55 error code: does not support._ `alert(myObj);` alerts the right object though. I'm working with InDesign CS5 (7.0) Object Model. – oystersauce Jun 08 '17 at 11:54
  • var myObj = app.selection[0].allGraphics[0]; – Vinny Jun 08 '17 at 12:21
  • The selection needs to be an image for the line to work ;) – Loic Jun 09 '17 at 09:49