Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
15

Hyperlinking Script for a digital Planner

Community Beginner ,
Jan 15, 2024 Jan 15, 2024

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.

TOPICS
Scripting
735
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Jan 15, 2024 Jan 15, 2024

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. 

 

Translate
Community Expert ,
Jan 15, 2024 Jan 15, 2024

Likely, you would have to do it manually, because each one must have the date unique to the calendar day.

Mike Witherell
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2024 Jan 15, 2024

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 15, 2024 Jan 15, 2024

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. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 15, 2024 Jan 15, 2024

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;
}
}
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2024 Jan 15, 2024

Scripting and frame script labeling are a frustrating enterprise. Manual can get you done in less time.

Mike Witherell
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jan 15, 2024 Jan 15, 2024
LATEST

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. 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines