-
1. Re: "Copy Link(s) to…" using javascript
Jump_Over May 6, 2014 8:37 PM (in response to phongsu)Hi,
copyLink(File) is a link's method.
However "How to write javascript" mostly depends on assumings.
Below code assumes:
Every valid link from active document is copied to destFolder keeping current file name.
var mDoc = app.activeDocument, mLinks = mDoc.links.everyItem().getElements(), destFolder = "~/Desktop/copiedLinks/", currLinkFName, currFile, len = mLinks.length; if ( !Folder(destFolder).create() ) exit(); while (len-->0) { currLinkFName = mLinks[len].filePath; currFile = File( destFolder + File(currLinkFName).name ); if (File(currLinkFName).exists) mLinks[len].copyLink(currFile); }Jarek
-
2. Re: "Copy Link(s) to…" using javascript
phongsu May 13, 2014 9:00 AM (in response to Jump_Over)Jump_Over,
Thanks, I will give it a try.
-
3. Re: "Copy Link(s) to…" using javascript
phongsu May 13, 2014 9:20 AM (in response to phongsu)Wow, it worked. You are awesome. I have been trying to figure that out for weeks. Now, I have to figure it out how to replace the deskFolder with the user input.
-
4. Re: Re: "Copy Link(s) to…" using javascript
Jump_Over May 13, 2014 9:50 AM (in response to phongsu)Hi,
1. Change a "correct" answer to mine, pls
2. In case of user input you can modify the line:
destFolder = Folder.selectDialog("Show me a target folder") + "/";Is it helpful
Jarek
-
5. Re: "Copy Link(s) to…" using javascript
phongsu May 13, 2014 3:51 PM (in response to Jump_Over)Jarek,
Yesss, I should have gone to this forum a long time ago. I am running to a problem. I have several identical links in my Indesign file, when I run the script, Indesign stopped and said "the link already exists (because it can not "save" over the existing one in the same folder). Is there a way I can bypass this. Something like
if (currFile.exists)
// bypass this command
Sorry, I am notice to Javascript. I am so excited to learn Javascript. Thanks for helping.
I am an expert in Indesign (non-script) of course, please ask me if you had any question in that area.
Phong
-
6. Re: Re: "Copy Link(s) to…" using javascript
Jump_Over May 13, 2014 4:26 PM (in response to phongsu)Hi,
Right, It can result with error. To bypass modify this line:
if ( !currFile.exists && File(currLinkFName).exists )
Jarek

