Copy link to clipboard
Copied
Hi All,
I am working on creating a planner in indesign. I have monthly pages with Google icons, which is an image. I want to ad an external links so it adds a date to the google calender.
The links would like this:
https://calendar.google.com/calendar/u/0/r/eventedit?action=TEMPLATE&dates=20240126/20240126
is there an easy way to do this please using a script and csv file? I have to do this 365 times.
I see, I had hoped Indesigns Script feature would be the answer to all.
For now i'll try bugging around with ChatGPT to see if I can solve this, if not then I'll try the manual route.
Copy link to clipboard
Copied
Likely, you would have to do it manually, because each one must have the date unique to the calendar day.
Copy link to clipboard
Copied
Really depends on how the doc is built and the incons are associated (or not) to any containing box. Likely, based on your screenshot there is not much correlation, so you'd have to get pretty wild by writing an algorithm to sort the icons on the page and then associate them by date. Probablya script to handle a single page is most feasible since you likely have other nonmonth pages in between. Still not a trivial task.
Copy link to clipboard
Copied
I now have every image in a seperate layer called GoogleLogos, it's also in ascending order. So the first image in the layer is for jan 1th, the 15th image in the layer is for jan 15th.
I've tried writing a script to give all the images a Script label, but I can't seem to get it working.
Copy link to clipboard
Copied
Right now i'm trying to write a script with ChatGpt to give each of the google Images a script label, so that it's easier to then write another script that connects each google calender link to the correct script label with a csv file.
But i can't get it to work. At the end of the script it selects each image and in the Script Label view I can see the new Script Label name gets added, then after the script is done and I deselect the image and reselt it, the Script label window is empty for all images and all script labels seems to be empty again.
any advice on this?
var myDocument = app.activeDocument;
var myLayer = myDocument.layers.itemByName("GoogleLogos");
var myItems = myLayer.allPageItems;
var day = 1;
for (var i = myItems.length - 1; i >= 0; i--) {
var myItem = myItems[i];
if (myItem instanceof Image) {
var dayFormatted = ("0" + day).slice(-2);
var label = "google_" + "01" + "-" + dayFormatted;
myItem.label = label;
// Verify that the label is set
if (myItem.label === label) {
alert("Label successfully set for item " + i + ": " + label);
} else {
alert("Failed to set label for item " + i);
}
day++;
if (day > 31) {
alert("End of month reached.");
break;
}
}
}
for (var i = myItems.length - 1; i >= 0; i--) {
var myItem = myItems[i];
if (myItem instanceof Image) {
var dayFormatted = ("0" + day).slice(-2);
var label = "google_" + "01" + "-" + dayFormatted;
myItem.label = label;
// Select the item and pause the script
myDocument.select(myItem);
alert("Item " + i + " selected with label: " + label);
day++;
if (day > 31) {
alert("End of month reached.");
break;
}
}
}
Copy link to clipboard
Copied
Scripting and frame script labeling are a frustrating enterprise. Manual can get you done in less time.
Copy link to clipboard
Copied
I see, I had hoped Indesigns Script feature would be the answer to all.
For now i'll try bugging around with ChatGPT to see if I can solve this, if not then I'll try the manual route.