Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: Decrementing a date

$
0
0

Thanks very much for this Dave. I’m learning a lot with this.

 

Unfortunately, it gave me an error with this at line 12:

Source:     myFind[j].characters.itemByRange(startIndex,endIndex).texts[0].content s - decString;

 

I think your script is searching for an actual date (month & day) to decrement (no?) and that is probably where it is hanging up.

The Loop is where it seems to get caught.

 

I’m not exactly sure why but I think it has to do with the InDesign Text Variable for the month. Like I mentioned, the month is an InDesign Text Varibable that I set when I first create a newsletter from a template. All the month call-outs throughout the newsletter are set to this variable so I can just change it once and it changes them globally in the new newsletter. A tremendous time saver. The problem is, Javascript isn’t recognizing these as a month (or even a string). I’m not sure how to deal with the whole Text Variable assignment issue since I absolutely need to keep them in the Template. I’ve looked through the Scripting Guides and can’t find anything referencing them but maybe I’m looking in the wrong place.

 

I’ve been trying (unsuccessfully) to do some simple scripts like just Find the day number (in the 3rd class-info line) and change it to a different number.

 

Here’s what I’ve been manually doing with a Find to select the date I want to change:

 

1) I set the:

     Find What: “~v \d”,

     Change to: blank,

     Search:“Story”,

     Find Format: Paragraph Style: "Class Info3”

     (all this criteria is actually saved as a Query preset).

2) I click Find and it goes immediately to the instance that I want to change (line three of my class info paragraph).

3) I click Done

4) I press the Right Arrow to deselect the selection and jump to the end of the day number

    (this is because both the Text Variable and the date are selected together).

5) I press shift+Left Arrow once (or twice depending on whether it’s a one or two digit number) to select the day number.

6) Type the new day number (1 day less than the class day).

 

Doing all this automatically in a script, of course, is what my hope is. At this point, I’m just having difficulty getting the Find criteria right in a script.

 

Thanks again for all your help. It has really taught me a lot.

Warmest regards,

⁓Rocky


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>