cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X

Change color entities in macro

FrancisPaille
7-Bedrock

Change color entities in macro

Hi everybody,

I'm stuck with this one...

I try create macro to select everything countaining color fill exept for the Black, White, and no fill, and apply to a pre define color called Shaded Area who is a black 45%. If somebody could help with that one it will be much appreciated!

Thanks a lot!!!


Macro Shaded Area

Add color "Shaded Area"
activeDoc.colors["Shaded Area"].kind = "CMYK_color"
activeDoc.colors["Shaded Area"].color.type = "cmykValues"
activeDoc.colors["Shaded Area"].color.CMYK = "{CMYK 0 0 0 0.45}"

Select if Color is not equal to '$ISO_NOFILL'
Subselect if Color is not equal to 'Black'
Subselect if Color is not equal to '$ISO_WHITE'

Color "Shaded Area"
Select none

End Macro

1 ACCEPTED SOLUTION

Accepted Solutions

This may not be the best way, but it works

Macro Shaded_Area

Define i as Integer
Define Count as Integer
Define el as Element


Add color "Shaded_Area"
activeDoc.colors["Shaded_Area"].kind = "CMYK_color"
activeDoc.colors["Shaded_Area"].color.type = "cmykValues"
activeDoc.colors["Shaded_Area"].color.CMYK = "{CMYK 0 0 0 0.45}"


Select if Color is not equal to '$ISO_NOFILL'
Subselect if Color is not equal to 'Black'
Subselect if Color is not equal to '$ISO_WHITE'


Count = activeDoc.selectedElements

el = activeDoc.firstSelectedElement

Define myFill as Fill
myFill.type = "color"
myFill.colSpec.type = "colorRef"
myFill.colSpec.color = "Shaded_Area"

for i = 1 to Count

el.fill = myFill

el = el.nextSelectedElement

End for
Select none

End Macro

View solution in original post

3 REPLIES 3

I've had a go at it myself, but can't find a way to change the color. When you use record macro, the resulting file is blank when at the bit where you change the color, making me think they've not put in an facility to change fill colours. Hope someone proves me wrong

This may not be the best way, but it works

Macro Shaded_Area

Define i as Integer
Define Count as Integer
Define el as Element


Add color "Shaded_Area"
activeDoc.colors["Shaded_Area"].kind = "CMYK_color"
activeDoc.colors["Shaded_Area"].color.type = "cmykValues"
activeDoc.colors["Shaded_Area"].color.CMYK = "{CMYK 0 0 0 0.45}"


Select if Color is not equal to '$ISO_NOFILL'
Subselect if Color is not equal to 'Black'
Subselect if Color is not equal to '$ISO_WHITE'


Count = activeDoc.selectedElements

el = activeDoc.firstSelectedElement

Define myFill as Fill
myFill.type = "color"
myFill.colSpec.type = "colorRef"
myFill.colSpec.color = "Shaded_Area"

for i = 1 to Count

el.fill = myFill

el = el.nextSelectedElement

End for
Select none

End Macro

Wow it work so well!!!

Big thanks to you, it is much appreciated!!!!

Top Tags