This content has been marked as final. Show 7 replies
In CS3 and CS4 you don't need a script for this. Using the GREP tab in the Find/Change dialog, do this:
Find what: \A(\d\d)\z
Change to: $1¢
\A stands for "beginning of story", \d is "any digit", \z means "end of story", so by searching for \A\d\d\z you're looking for stories that consist of two digits. This would work only if those two-digit text frames are not threaded.
Thanks Peter, but I'm working on CS2. So i need a script that will find all instances of 10-99 and add a ¢ sign
> Thanks Peter, but I'm working on CS2. So i need a script that will find all instances of 10-99 and add a ¢ sign
In other words, replace the $0.50 with 50¢ in one pass instead of two. Not sure
how this would look in InDesign-grep syntax. The str.replace call uses plain
In CS2 it's a little more complicated. As X said, you can replace $0.50 to 50¢ in one pass:
myStories = app.activeDocument.stories.everyItem().getElements();
for (i = 0; i < myStories.length; i++)
if (myStories[i].contents.length == 5)
myStories[i].contents = myStories[i].contents.replace (/\$0\.(\d\d)/, "$1¢")
Thank you guys, it worked!
Woops, it doesn't seem to work if there's an anchored object in the text box! Can I get some help please?
>it doesn't seem to work if there's an anchored object in the text box!
We could have told you that:) If each and every $0.nn price is to be changed to nn¢, irrespective of whatever else is in your text frames, then you can get around it easily. If not, it gets a bit tougher.