3 Replies Latest reply on Oct 26, 2009 3:57 PM by [Jongware]

    Not sure where to start...


      ok - im going to post my scenario.   feel free to direct me to where and how i should be looking.  i am not sure about the best way to go about this....


      i have the ability to use pretty much any cs4 app - but indesign is my first best guess about where to make this happen.   i've never had any experience scripting anything for any adobe app, but i do understand basic script speak.  basic.   just keep that in mind please. 8)


      ok - based on a customer's order, i want to be able to either directly print the results, or just generate this on screen to be able to enter the print dialogue.  either is fine.


      there will be 4 different categories of images (A,B,C,D)  A is background art, B,C,D are mostly small chunks of text.  on the template that i will need to use will be 18 'spots' or 'ups'.   Each 'up' will contain one of each, A,B,C,D laid down in alphabetical order, obviously so that the chunks of text will be visible above the background artwork.      (x) number of the 'ups' will be the same.  usually anywhere from 3 to all 18.  but i would like the ability to assign a different grouping of A,B,C,D so that if i only need 3 'ups' to use arrangement 1, i can assign another number (y) of 'ups' to arrangement 2, and even (z) to arrangement 3 if need be.   i suppose for sake of argument, i would want to be able to have 18 different arrangements per layout.


      a gui that enables 4 textboxes for selection of each element and how many 'ups' to place of each arrangement would be grand.   people who are computer competent, but far from script level users will be running the app.


      A,B,C,D file sizes and types are negligible.  i can generate the files as whatever type will work best, and each 'up' is at most 1.75 x 4.75 inches.  only background art (A) would take that entire space (that includes bleed).


      the results do need to be exact and consistent.  they will ultimately be cut out using a die press.


      is this the info i need to provide to start finding a solution or are there things i  have left out?


      thanks for any info.



        • 1. Re: Not sure where to start...
          [Jongware] Most Valuable Participant

          For clarity, can you post an image of a complete document, indicating B, C, and D? (A is perfectly clear )

          How would you select the sources for A..D? Is it from a known set of choices, from a list of existing documents, or what?


          With scripting, you can import and place any external image with extreme precision; just last week, I wrote a script for a co-worker to import no less than 202 images, in sets of 4 per page, positioning and scaling them to fit. Writing the script took about half an hour, running it another 10 minutes. By hand it would have cost him, well, I dunno ... a day?

          All it takes for you is a list of the exact positions for each of the 18 different ones -- a script can place "B" as often as asked, then switch over to "C", and finally fill up to 18 with "D". This (extremely basic) javascript might give you an idea of what's possible, although it doesn't "do" anything yet!


          myDialog = app.dialogs.add ({name:"Place Ups",canCancel:true});
          bglist = [ "background 1", "background 2", "background 3", "background 4" ];
          imagelist = [ "image 1", "image 2", "image 3", "image 4" ];
          with (myDialog)
           with (dialogColumns.add())
            with (dialogRows.add())
             staticTexts.add ({staticLabel:"Background image"});
             bgDropDown = dropdowns.add ({stringList:bglist, selectedIndex:0});
            with (dialogRows.add())
             staticTexts.add ({staticLabel:"Up 1"});
             up1number = textEditboxes.add ({editContents:"0"});
             up1img = dropdowns.add ({stringList:imagelist, selectedIndex:0});
            with (dialogRows.add())
             staticTexts.add ({staticLabel:"Up 2"});
             up2number = textEditboxes.add ({editContents:"0"});
             up2img = dropdowns.add ({stringList:imagelist, selectedIndex:0});
            with (dialogRows.add())
             staticTexts.add ({staticLabel:"Up 3"});
             up3number = textEditboxes.add ({editContents:"0"});
             up3img = dropdowns.add ({stringList:imagelist, selectedIndex:0});
          if (myDialog.show() == false)
          // do something here ...

          Copy, paste into a plain text editor (the ESTK that came with InDesign is good), and save as "placeXup.jsx" into your local scripts folder. Double-click to run. It should display a dialog with a few functions, then do nothing at all (what it should do is yet to be decided).

          1 person found this helpful
          • 2. Re: Not sure where to start...
            chachapaco Level 1

            i can't upload a completed image per company legalistic blah blah, but its basically the one background image, A, that covers the entire space of each 'up'.   B, C, D are just blocks of text, just a few words each, that lay on top of the art, lets say, each taking up one third of the available space.   the underlying art, A, is still mostly visible.  my preference from choosing each A, B, C and D would be to have four different directories read so that the user could choose their configuration.  there would be additional files added on a weekly, if not daily, basis, which is why i would like for the directories to be re-read each time.


            im gonna take a crack at it over the next couple of days and see what i can do.  8/

            • 3. Re: Not sure where to start...
              [Jongware] Most Valuable Participant

              It doesn't really has to be an existing image, a mock-up will do (just to confirm I got the right idea).


              While on the subject: your 18 positions, are those fixed? If so, you could probably best make a template without any background at all (or a placeholder that will be replaced by the actual one), and position the 18 boxes in advance. Use the Script Label panel to give each of them a unique label; that way, you can immediately use javascript to select each of the boxes and set its contents. If they are mere textframes, to receive a number of plain text lines, you can also apply the proper styling in advance, so the font and size and such are set in advance (or to reasonable defaults). You could also set its horizontal and vertical alignments to "Center".


              All the script has to do at that point is open the template (and ID will automatically create an "Untitled" document from it), show your dialog, and loop over the labeled textframes. (It sounds so easy.)


              As for your reading-out-of a set of folders, Javascript has a great function "Folder.getFiles", that fills an array with the files in that folder.