Skip to main content
Known Participant
October 26, 2011
Answered

How to Set the Colow for a Watermark

  • October 26, 2011
  • 2 replies
  • 1444 views

Foe CS5/ActionScript:

Hi all,

I want to change the default color of a watermark. So I tried:

[code]

m_workingDocument.watermarkPreferences.watermarkFontColor = myIndesignApp.colors.add({name:"WatermarkColor", model:ColorModel.PROCESS, colorValue:[0,100,100,0]});

[/code]

and

[code]

m_workingDocument.watermarkPreferences.watermarkFontColor = myIndesignDocument.colors.add({name:"WatermarkColor", model:ColorModel.PROCESS, colorValue:[0,100,100,0]});

[/code]

Both throw a null exception at run time.

What am I doing wrong?

Also, is there any way to create a color on the fly which does NOT appear in the swatches panel? (I don't want customers to be able to change the defintion of the color to white, so that the watermark becomes invisible...).

TIA,

mlavie

This topic has been closed for replies.
Correct answer tomaxxi

Hey Malvie,

Yes, that's my work

Olav is correct. watermarkFontColor accepts only RGB and UI colors.

So, something like this will work:

var docWater = app.activeDocument.watermarkPreferences;

docWater.watermarkFontColor = [255,0,255] // Magenta

Hope that helps.

--

Marijan (tomaxxi)

http://tomaxxi.com

2 replies

Participating Frequently
October 27, 2011

Hi mlavie,

Off the top of my head, I'm pretty sure it'll work if you use a UI color. An RGB color might also work. As I recall (dimly) watermarks are kind of strange.

Thanks,

Ole

Harbs.
Legend
October 27, 2011

Ah. UI colors. I always forget those exist...

Harbs

Harbs.
Legend
October 26, 2011

I had some issues with type info and colors myself in AS.

Try first creating the color and then applying it. If all else fails, just do it in ExtendScript...

As far as adding unnamed colors go: there's no straight-forward way to add them with scripting.

I came up with a hack a little while ago:

http://forums.adobe.com/message/3931882#3931882

Harbs

mlavieAuthor
Known Participant
October 26, 2011

Harbs. - thanks.

I just realized that Marijan ("Tomaxxi") has a freebie Watermark extension which handles the colors and also leaves no color defitniton behind in the Swatches Panel. Perhaps if he reads this he'd be gracious enough to help me  out...

mlavie

tomaxxi
tomaxxiCorrect answer
Inspiring
October 27, 2011

Hey Malvie,

Yes, that's my work

Olav is correct. watermarkFontColor accepts only RGB and UI colors.

So, something like this will work:

var docWater = app.activeDocument.watermarkPreferences;

docWater.watermarkFontColor = [255,0,255] // Magenta

Hope that helps.

--

Marijan (tomaxxi)

http://tomaxxi.com