Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Need a simple script to manipulate some elements

Return to Forums

  • Author
    Posts
    • #62901
      Anonymous
      Inactive

      I am trying to learn how to write in javascript, but it seems it is tediously slow for me. I don't have dedicated time, and the script I need is simple, repetitive and perfect for scripting. (Recording actions would be a great help, Adobe.) I am looking to see if anyone is interested in writing this script, or at least getting me started.

      I have a layout of 6 elements (an optional graphic, and two text boxes) in a 2 column setup. I need to copy these elements onto a new page, then swap the elements left-to-right, essentially taking the left column and putting it on the right and vice versa. This is so that the second page can print on the back side of the first page and the elements print back-to-back. A simple diagram:

      page 1 before script:

      A B

      C D

      E F

      After script, pages 1 & 2:

      A B B A

      C D D C

      E F F E

      I do this by hand, but I do several thousand of these every year and it is time consuming. Automating it would be a boon to me.

      The elements might change in what they contain (one or a few text boxes, none or one graphic). They are not grouped together, but could be. The size of the element is always 4″x3″ and always swapped in the same configuration as above. The starting configuration is the result of a data merge, so the number of pages will vary. The final result is that the even pages are duplicates of the odd pages (with the appropriate swapping of columns), and so there will always be an even number of pages in the final doc.

      The pseudo-code I see is:

      While not eof {

      for each existing page {

      create new page after the existing one

      copy elements to the new page

      swap columns of elements

      } end for

      } end while

      Any takers? Any help?

      Thanks,

      Jake

    • #62992
      Anonymous
      Inactive

      After much frustration in trying to figure out which methods and properties can be used, I was able to write a script that actually works! I am not sure I want to go through that process again. The documentation is incredibly confusing (upper case where it shouldn't be, no help in accomplishing a task, only what properties and methods there are, and only with minimal information when you find it – even the tutorials I found say you have to poke around and try to make logical guesses as to what property applies to your task).

      Nonetheless, after probably 12 hours of following examples (many of which didn't work, despite copy and paste), I now have a working script that is all of 28 relevant lines of code. It can be expanded should I need it, and I am trying to find other places that it might be useful to me. If anyone wants to see it or has a similar requirement, I am happy to share it.

      Jake

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Forum Ads