0

I have a script for our newspaper that pulls comics from a folder and places them in an InDesign document. Most comics have the full date in the filename, but a few Sunday comics go by the week number for that Sunday. I.E. Blondie sunday filenames are like bln04ts.pdf or bln05ts.pdf. When we run the script we select the day to pull comics for but I'm unsure how to pull these files by week number?

Here is a sample by full date in filename if that helps at all.

       ` // LUANN
        if (pageItem.label == "LUANN")
        try{
            name = "lu" + myDate.text + ".tif"
            var myFile = new File(imagePath+name);
            if (myFile.exists)
            {
                pageItem.place(myFile); 
                pageItem.fit(FitOptions.CONTENT_TO_FRAME);
                }

            name = "lu" + myDate.text + "_vacation.tif"
            var myFile = new File(imagePath+name);
            if (myFile.exists)
            {
                pageItem.place(File(myFile)); 
                pageItem.fit(FitOptions.CONTENT_TO_FRAME);
                }

            name = "lu" + myDate.text + "_crx.tif"
            var myFile = new File(imagePath+name);
            if (myFile.exists)
            {
                pageItem.place(File(myFile)); 
                pageItem.fit(FitOptions.CONTENT_TO_FRAME);
                }

            }catch(err){
                //alert("caught error")
                }`

Any ideas?

schnarkle
  • 15
  • 6

1 Answers1

0

Well, if I understand you correctly you would need to add some lines like these to your script:

name = "bln" + myDate.week + "ts.pdf";
var myFile = new File(imagePath+name);
if (myFile.exists)
    {
    pageItem.place(File(myFile)); 
    pageItem.fit(FitOptions.CONTENT_TO_FRAME);
    }

However you'll also need to change the setup of you myDate object to include a week property. I don't know how the myDate object is set up (does it create the date text from the current date? Or from the file name of the document? Or something else?), so you would need to post a snippet of that, if you need further assistance on that step.

mdomino
  • 1,195
  • 1
  • 8
  • 22