-
1. Re: Script for Linking Images with Url's from a Spreadsheet
Kasyan Servetsky Sep 11, 2017 10:58 PM (in response to meganm24796850)I think the Auto hyperlink script (by Nobrainer Scripting) may come in handy to you. You can save the csv-file as txt leaving only product names and URLs separated by tabs.
-
2. Re: Script for Linking Images with Url's from a Spreadsheet
Liphou Sep 13, 2017 12:22 AM (in response to meganm24796850)Hello here is a code that I started to regroup because I will also be led to do the same
Bonjour voici un code que j'ai commence à regroupé car je serai aussi amené à faire la même chose
var imgs = app.activeDocument.allGraphics; $.writeln (imgs.length); for (var i = 0; i < imgs.length; i++) { // imgs[i].verticalScale = 92; //imgs[i].horizontalScale = 92; //imgs[i].fit(FitOptions.FRAME_TO_CONTENT); // imgs[0].parent.appliedObjectStyle = "LeStyle"; // imgs[0].parent.applyObjectStyle( "LeStyle" ); $.writeln(imgs[i].parent.appliedObjectStyle.name); $.writeln(imgs[i].itemLink.filePath);// = app.activeDocument.objectStyles.itemByName("LeStyle"); // Faire controle $.writeln(imgs[i].itemLink.name);// = app.activeDocument.objectStyles.itemByName("LeStyle"); // Faire controle try{ myHyperlinkURL = app.activeDocument.hyperlinkURLDestinations.add('http://www.apple.com'); myHyperlinkSource = app.activeDocument.hyperlinkPageItemSources.add(imgs[i].parent); myHyperlink= app.activeDocument.hyperlinks.add(myHyperlinkSource,myHyperlinkURL); myHyperlink.visible=false; } catch(myError){ } }//
-
3. Re: Script for Linking Images with Url's from a Spreadsheet
monicam90436292 Sep 20, 2017 4:30 PM (in response to Kasyan Servetsky)Hi Kasyan,
This script sounds perfect for the project I'm working on! I'm having some issues making it work though and was hoping you could help. If I'm keeping the txt filed named the exact same do I need to change anything in the script?
Thanks!
Monica -
4. Re: Script for Linking Images with Url's from a Spreadsheet
Kasyan Servetsky Sep 21, 2017 7:36 AM (in response to monicam90436292)Hi Monica,
No, you don't have to interfere in the script; the user is supposed to edit the txt-file only.
However, if your project has some specific requirements, the script may need some adjustments.
Regards,
Kasyan -
5. Re: Script for Linking Images with Url's from a Spreadsheet
monicam90436292 Sep 22, 2017 11:31 AM (in response to Kasyan Servetsky) -
6. Re: Script for Linking Images with Url's from a Spreadsheet
Kasyan Servetsky Sep 22, 2017 11:36 AM (in response to monicam90436292)I guess you don't have the character style named "hyperlink" in the document.
— Kas
-
7. Re: Script for Linking Images with Url's from a Spreadsheet
monicam90436292 Sep 22, 2017 12:03 PM (in response to Kasyan Servetsky)I do but I've had to manually put it in (it wasn't automatically in my character styles)
Monica
-
8. Re: Script for Linking Images with Url's from a Spreadsheet
monicam90436292 Sep 22, 2017 12:09 PM (in response to Kasyan Servetsky)I got it! Just had to make the hyperlinks character style all lower case! Thanks for the help!!
Monica
-
9. Re: Script for Linking Images with Url's from a Spreadsheet
Kasyan Servetsky Sep 22, 2017 12:13 PM (in response to monicam90436292)The script doesn't add it automatically. I'm not the author of the script so that's the way Nobrainer Scripting designed it.
— Kas
-
10. Re: Script for Linking Images with Url's from a Spreadsheet
monicam90436292 Sep 22, 2017 1:44 PM (in response to Kasyan Servetsky)Hi Kas sorry hopefully last question!
So I've gotten the script to work on one of my indesign documents and was hoping to use it on another one but when I do I'm getting an error message saying "This name is already in use by another object" I have tried making a copy and changing the name of the jsx file as well as the txt file but am still getting the same error!
Monica
-
11. Re: Script for Linking Images with Url's from a Spreadsheet
Kasyan Servetsky Sep 24, 2017 12:31 AM (in response to monicam90436292)Hi Monica,
I remember I encountered and solved this problem in the past, but at the moment I can't recreate it.
Probably the document already has hyperlinks (e.g. you already run the script on it) and it attempts to use the found text (source) which is already taken by another hyperlink. You can't do this manually so it's impossible to do by script as well. The screenshot illustrates the situation:
But this is only my guess. I can't give you a more definite answer without seeing the document.
— Kas