Copy link to clipboard
Copied
Hi,
I have used the script to get the image link's path. For a month it's working fine in the InDesign previous versions but by using the latest version of InDesign I can't able to retrieve the image path. I have attached the script which I used to retrieve the image path
var doc = app.activeDocument;
// Loop through all the links in the document
var link = doc.links[0];
// Get the file path of the linked image
var filePath = link.filePath;
// Create a File object from the file path
var file = new File(filePath);
// Get the folder path of the file
folderPath = file.parent.fsName;
Copy link to clipboard
Copied
What are we supposed to understand by "can't able to retrieve the image path"? Please provide more details like
-Manan
Copy link to clipboard
Copied
Hi @MonishaRajendran , Did you try checking the returned paths via a $.writeln()? You could simplify with this, but what you have should work.
var doc = app.activeDocument;
//a test link on the desktop
var link = doc.links[0];
//link as a file
var file = new File(link.filePath);
//link file’s parent folder
var folderPath = file.parent
$.writeln(file)
//returns ~/Desktop/testlink.png
$.writeln(folderPath)
//returns ~/Desktop
Find more inspiration, events, and resources on the new Adobe Community
Explore Now