The third one is for adding a CMYK color with a name composed out of the CMYK values.
- Code: Select all
set ColorCheck to false
tell application "QuarkXPress"
if exists document 1 then
activate
set DefaultAnswer to "0 0 0 0"
repeat until ColorCheck is true
set NewColor to text returned of (display dialog "New Color (C M Y K): " default answer DefaultAnswer)
set ColorValueList to words of NewColor
set ColorValueNumber to count items of ColorValueList
set ColorCheck to true
if ColorValueNumber = 4 then
set ColorValueCyan to item 1 of ColorValueList as number
set ColorValueMagenta to item 2 of ColorValueList as number
set ColorValueYellow to item 3 of ColorValueList as number
set ColorValueBlack to item 4 of ColorValueList as number
if ColorValueBlack < 0 or ColorValueBlack > 100 then
set ColorCheck to false
set ErrorDialog to "Black isn't between 0 and 100!"
set DefaultAnswer to NewColor
end if
if ColorValueYellow < 0 or ColorValueYellow > 100 then
set ColorCheck to false
set ErrorDialog to "Yellow isn't between 0 and 100!"
set DefaultAnswer to NewColor
end if
if ColorValueMagenta < 0 or ColorValueMagenta > 100 then
set ColorCheck to false
set ErrorDialog to "Magenta isn't between 0 and 100!"
set DefaultAnswer to NewColor
end if
if ColorValueCyan < 0 or ColorValueCyan > 100 then
set ColorCheck to false
set ErrorDialog to "Cyan isn't between 0 and 100!"
set DefaultAnswer to NewColor
end if
else
set ColorCheck to false
set ErrorDialog to "Four color values need to be entered!"
set DefaultAnswer to NewColor
end if
if ColorCheck is false then
display dialog ErrorDialog buttons {"OK", "Cancel"}
end if
end repeat
set ColorName to "C" & ColorValueCyan & " M" & ColorValueMagenta & " Y" & ColorValueYellow & " K" & ColorValueBlack
set QXPColorValueCyan to (ColorValueCyan * 655.35) div 1
set QXPColorValueMagenta to (ColorValueMagenta * 655.35) div 1
set QXPColorValueYellow to (ColorValueYellow * 655.35) div 1
set QXPColorValueBlack to (ColorValueBlack * 655.35) div 1
try
tell document 1
if not (exists color spec ColorName) then
make new color spec at beginning with properties {class:color spec, color type:CMYK type, angle:"45", CMYK color value:{QXPColorValueCyan, QXPColorValueMagenta, QXPColorValueYellow, QXPColorValueBlack}, name:ColorName, separation:true}
end if
end tell
end try
end if
end tell
If you own Keyboard Maestro: more useful macros can be found here: http://forums.quark.com/viewtopic.php?f=17&t=28981