-
1. Re: How to use character styles in the Find/Change JavaScripts?
Harbs. Mar 31, 2011 2:53 PM (in response to Gary Niemeier)What version of InDesign is this with?
-
2. Re: How to use character styles in the Find/Change JavaScripts?
Gary Niemeier Mar 31, 2011 3:00 PM (in response to Harbs.)It's CS5. I noticed the example Find/Change text file (that came with CS5) actually referred to CS4. But it's clear that JavaScript changed with CS5. Thanks for your quick response. —Gary.
-
3. Re: How to use character styles in the Find/Change JavaScripts?
Mayhem SWE Apr 1, 2011 12:54 AM (in response to Gary Niemeier)Gary Niemeier wrote:
{include footnotes:true, include master pages:true, include hidden layers:true, whole word:false}
This is not valid JavaScript, looks more like it was copied from an AppleScript but not modified properly. The property keys for the options should not contain any spaces, they must be written as:
{includeFootnotes:true, includeMasterPages:true, includeHiddenLayers:true, wholeWord:false} -
4. Re: How to use character styles in the Find/Change JavaScripts?
Gary Niemeier Apr 1, 2011 6:55 AM (in response to Mayhem SWE)You are absolutely correct. I don't know how those spaces got there! I copied the text from the "FindChangeList.txt" document, but somewhere along the way, a software program "helpfully" added the spaces. (Rest assured, it wasn't copied from AppleScript. I stick with JavaScript.) Anyway, the script now runs like a charm.
My thanks to you! Another "newbie" mistake easily spotted, eh?
One thing, though, if Adobe is reading this: please flesh out the "FindChangeList.txt" file for those who are not programmers/scripters. I'm just a normal InDesign user, and I really need examples of basic syntax in order to use the "Find/Change" script correctly. I'm referring to the syntax involved with finding or changing text with a certain character or paragraph style. I often search for styles, and those properties should be provided in the help file. A couple of samples are all that's needed. (I did read through the JavaScript reference guide provided by Adobe, and even in the "Find/Change" section, it did not provide this information!). Furthermore, I often search text for a specific font. Why isn't this syntax included as well? It would easy to do and would save users a lot of fumbling around.
Thanks again, all the best.
-
5. Re: How to use character styles in the Find/Change JavaScripts?
Mayhem SWE Apr 1, 2011 9:17 AM (in response to Gary Niemeier)Gary Niemeier wrote:
You are absolutely correct. I don't know how those spaces got there! I copied the text from the "FindChangeList.txt" document, but somewhere along the way, a software program "helpfully" added the spaces. (Rest assured, it wasn't copied from AppleScript. I stick with JavaScript.) Anyway, the script now runs like a charm.
If I were to guess, you copied the text from the comment part in the beginning of the example file and not from the part of the file which is actually executed. At least in the example scripts for CS3 this portion is wrong in this exact way and it seems they still haven't fixed it for the CS5 example scripts! Most likely the original author copied this part from the AppleScript version of the example scripts...
-
6. Re: How to use character styles in the Find/Change JavaScripts?
Gary Niemeier Apr 1, 2011 9:51 AM (in response to Mayhem SWE)Right again! I checked the file provided with InDesign CS5, and it does show the mistaken spacing in the comment section. That's where I copied it from. Not only is this sloppy scripting (some example, huh?) but the fact that the error has been squatting there since CS3... that shows a lack of attention to detail that is the opposite of the rigor needed for scripting success. Is there any way to bring this to Adobe's attention? Do they read the forum postings?
I'm glad Adobe provides these forums. I appreciate the help from people like you. I hope Adobe will read this and decide to tighten up their scripting examples (and please provide more syntax examples for styles and fonts).
All the best.



