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

Auto-import images based on variable

Community Beginner ,
Feb 18, 2013 Feb 18, 2013

Copy link to clipboard

Copied

I would like to automate the import of several images onto a single page.

The person working on the page should receive a prompt asking for a publication name and a date.

The publication would be used to tell the script in which network folder to find the images.

The date would be used to construct the file name based on which picture frame the script is currently working on.

The single-page InDesign template they are working on would have several picture frames.  The frames will "never" change.

Although I'm sure there's something out there like this, I've be unable to find anything.

Anyone know of anyting or willing to share any code to get me started?

Thanks.

ID 5.5, Windows 7, Java Script

TOPICS
Scripting

Views

1.0K

Translate

Translate

Report

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
Enthusiast ,
Feb 18, 2013 Feb 18, 2013

Copy link to clipboard

Copied

Hi,

you'll find parts but not your special workflow. Without any experience in scripting ...

If you don't want to spent time yourself -> think of investing a bit of money to anyone who'll spent his'

Votes

Translate

Translate

Report

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 ,
Feb 18, 2013 Feb 18, 2013

Copy link to clipboard

Copied

I do have scripting and programming experience, but JavaScript is not my forte...

Votes

Translate

Translate

Report

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
Enthusiast ,
Feb 19, 2013 Feb 19, 2013

Copy link to clipboard

Copied

Hi,

what should be the sources for the publication names and a dates to be provided?

Votes

Translate

Translate

Report

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 ,
Feb 19, 2013 Feb 19, 2013

Copy link to clipboard

Copied

has the OP looked into Fuga Tech? http://fuga-tech.com/

I think it might do what the OP is after.

In the interest of full disclosure, I am NOT an employee of fuga tech, nor receive any payment announcing this link.

Colly

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!

Votes

Translate

Translate

Report

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
Enthusiast ,
Feb 19, 2013 Feb 19, 2013

Copy link to clipboard

Copied

Hi,

if you still want to do it yourself. Let's do the first step.

Here's a example for the userdialog. Release dates will livechange depending on selected publication.

#target Indesign

//e.g set some sample publications and release dates

var publications = new Array ();

var publication01 = new Object();

publication01 ["publication"] = "newspaper" ;

publication01 ["releaseDates"] = ["ndate01", "ndate02", "ndate03"] ;

publications.push(publication01);

var publication02 = new Object();

publication02 ["publication"] = "magazine" ;

publication02 ["releaseDates"] = ["mdate01", "mdate02", "mdate03"] ;

publications.push(publication02);

//alert the response

alert('Chosen Product & release Date: ' + someDialog().join(', '));

//userdialog

function someDialog()

{

var w = new Window ("dialog", "My Input");

w.alignChildren = "left";

var pnlpublication  = w.add('panel', undefined, 'Please choose a publication:');

pnlpublication.orientation = "row";

var myPublication = pnlpublication.add ("dropdownlist", [0, 0, 250, 10], [publications[0].publication,  publications[1].publication]);

myPublication.selection = 0;

var pnlDate  = w.add('panel', undefined, 'Please choose a release Date:');

pnlDate.orientation = "row";

var myDate = pnlDate.add ("dropdownlist", [0, 0, 250, 10],publications[0].releaseDates);

myDate.selection = 0;

var myButtonGroup = w.add ("group");

myButtonGroup.orientation = "row";

myButtonGroup.add ("button", undefined, "OK");

myButtonGroup.add ("button", undefined, "Cancel");

myPublication.onChange = function() {

    myDate.removeAll();   

    var getSel = myPublication.selection.text;

   

    switch(getSel){

case publications[1].publication : setListItems (publications[1].releaseDates); break;

default : setListItems (publications[0].releaseDates); break;

        }

   

   function setListItems (stringArray){

        for(var myItem = 0; myItem < stringArray.length; myItem++){

    myDate.add('item', stringArray[myItem])

}   

    }

myDate.selection = 0;

}

if (w.show () == 1){

   

    return [myPublication.selection.text, myDate.selection.text];

    w.close()

}else{

    w.close();

exit ();

}

}

Votes

Translate

Translate

Report

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 ,
Feb 19, 2013 Feb 19, 2013

Copy link to clipboard

Copied

I was able to change the date field pop-down to a edittext field and grab the needed info with a few very small modifications.

I was also able to put it together with another script which will place an image onto the page based on a string in a text box.

Since the pages always have exactly the same boxes on them, I'm thinking it might make more sense to grab the info and do a search and replace and then have the other script pull in the images.

For instance, it would search for {YYMMDD} and replace it with the info the user input into the date edittext field.

Thanks for the start!

Votes

Translate

Translate

Report

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
Enthusiast ,
Feb 19, 2013 Feb 19, 2013

Copy link to clipboard

Copied

LATEST

Your rules for placing the images are not as detailed explained. So I would, but can't give good advice here.

Keep in mind that page items can be labelled (Both: scriptlabel or GUI-label) and named.

Happy scripting!

Hans-Gerd Claßen

Votes

Translate

Translate

Report

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