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

Re: Decrementing a date

$
0
0

Thanks again Dave for responding. You bring up a good point about needing to create a month/day boundary handler.

 

I have been playing with your scripting suggestions and I think the biggest problem I'm facing now is with finding the number and isolating it from the month variable. If I use a Grep find of:

 

var myString = "~v \d"

app.findGrepPreferences.findWhat = myString;

 

It does find the first instance of the month variable and the day. However, I don't know how to get the second instance and then change ONLY the number. As I showed above, the lines for the class info is like so:

 

Sunday, Oct 6, 1:00 - 3:00 PM

Instructor: Professor Smith

1 Class - $30 by Oct 5 or $45 at the door.

 

You see that there are Time numbers as well as Class numbers to consider. So, just a general search for numbers isn't going to work. What I need to do is isolate the month from the day  because the month is a variable (I can definitely find it by using the Grep "~v \d").

 

Unfortunately, because the month is a variable it isn't recognized by javascript as a date (I'm not even sure it's recognized as a string)  therefore I need to somehow separate these, turn the day into an integer var, decrement it then find the next instance of the month variable then change it to the month variable PLUS the decremented day. The additional hurdle here is that the Grep won't let you change your find to an InDesign Text Vriable. It will only let you search for one. I don't know how to get past this hurdle either.

 

You mentioned earlier that having these defined in styles might help. Could you elborate on that? Can I limit a search to a style in the javascript? I know I can do this in a manual search but don't know how it's done in javascript.

 

You help is greatly appreciated and I am learning a lot from it.

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>