Skip to main content
July 16, 2009
Question

CS3 / Javascript / Highlight specified text

  • July 16, 2009
  • 1 reply
  • 2253 views

Hi Geeks,

I want to highlight some specifix text, that is suppose if i want to highlight "XXX" in the indesign file. Like ms-word highlight, Is there any option available in indesign?

Also i want to remove the highlight.

Regards,

sudar.

This topic has been closed for replies.

1 reply

Inspiring
July 16, 2009

Hi Sudar,

just create a character style with underline = true.

Play around with some properties of underline:

     underlineWeight near the value of leading,

     underlineOffset about -2.5 pt,

     underlineType,

     underlineColor,

     underlineTint ...

Martin  

July 16, 2009

Hi Martin,

Thanks for your quick reply.

I have already tried this one, when i try to remove the highlight, it is gonna be a problem, that is

with (app.findTextPreferences)

{

underline=true;

underlineOffset=-2;

underlineTint=100;

underlineWeight=7;

underlineColor=aDoc.swaches.item('Highlight');

findWhat="";

}

the Error "Required failed because object is from a different document or workspace".

Do you have any answer for this error?

Regards,

sudar.

Inspiring
July 16, 2009

Hi Sudar,

what are you trying to do with settings for underline in the 'app.findTextPreferences'?

Just create the character style as told above and then search for some text to apply the character style to the text that has been found (e.g. app.changeTextPreferences.appliedCharacterStyle = myHighlightCS;).

Search for some content, for a regular expression or another special property of the text.

The problem you have told is a known bug in CS3.

Workaround: add the color your are looking for to the swatches of the application and look for 'app.swatches.item('Highlight');'.

But - as I suppose - this is not, what you are looking for.

Martin