This content has been marked as final. Show 7 replies
the seach engine has changed in CS3.
So you have to make changes like this:
app.findTextPreferences = null;
app.findTextPreferences.capitalization = Capitalization.allCaps;
app.findChangeTextOptions.wholeWord = false;
var myResult = app.activeDocument.findText()
for ( i = myResult.length-1; i >= 0 ; i-- )
makeUpperCase( myResult[i] );
function makeUpperCase ( myText )
myText.capitalization = Capitalization.normal;
myText.changecase( ChangecaseMode.uppercase );
myText.insertionPoints[-1].contents = '<\\UC>';
myText.insertionPoints.contents = '<UC>';
Do you need the Tags?
If you don't, you can delete two lines or comment them:
// myText.insertionPoints[-1].contents = '<\\UC>';
// myText.insertionPoints.contents = '<UC>';
This is great, it is working really fine. The indesign of this false cap thing is really giving mi problem. haha. You had been a great help, if I want to do the same thing in indesign plugin, is it possible???
A plugin can do this and a lot more (google for "indesign plugin" and you can find some incredible free stuff: Tetris! An iTunes controller!). And JS is fast, but a plugin is, well, "immediate" comes to mind.
in an older version folder ("Scripts//Version 4.0 Scripts"), and chances are big it can run without problems. Even your script, of which Martin correctly states
>the seach [sic] engine has changed in CS3.
should run just fine in the 'older version' folder, because CS3 will recognize the older commands from there.
I see, I would like to pick up Indesign Plugin development but base on the SDK guide, it is quite hard to understand, wonder if there is any sample which is similiar to my issue here where I can pick and learn.
This is *much* easier to do in scripting. There is no point in learning the plug-in API in order to do something that scripting can already do perfectly. Use the plug-in API when you need to add something entirely new (such as a new capitalization style, for example); use scripting when you want to do something InDesign can already do (such as entering capital letters wherever the all caps style is found).
The reason for picking up SDK is because in the paragraph style of indesign, it only provide all cap instead of real uppercase, it will be best if the case field of paragraph style is able to have an additional true uppercase option that can be selected instead of all cap.
>true uppercase option that can be selected instead of all cap.
If you write a plugin that "applies" capitals, the underlying text will still be lowercase; but the text will be shown and printed as all caps. So, write a plugin that changes lowercase to capitals. ... Doesn't that sound familiar? Well, both options are already in InDesign.
A few more good reasons to use scripts, rather than plugins:
They are platform independent -- you can use the same script on the Macintosh and on the Windows versions of InDesign. That might or might not be useful. For a plugin, you need a full programming environment for the Mac version, AND a full programming environment for the Win version (AND lots of experience on both platforms to get it to run).
They are easily adjustable. Designing, developing, coding, and maintaining a plugin takes a lot of overhead. A script can be opened directly from within InDesign into your local plain text editor, edited, saved, and run again.