I am new here and downloaded recently a script shown below. The problem is it doesn’t seem to work because of a descriptor type mismatch on line 6. Could anyone help me out here.
Thanks
property colorExceptions : {“black”, “cyan”, “magenta”, “yellow”, “registration”, “white”}
tell application “QuarkXPress Passport”
activate
if not (exists document 1) then return
tell document 1
set colorList to name of (every color spec whose name is not in list colorExceptions as string) as list
beep
set newColor to (choose from list colorList) as text
try
set name of every graphic box to "graphic"
set box type of every graphic box to picture box type
end try
try
tell every text box
set color of (every character whose color is "black") to newColor
end tell
end try
try
set color of (every generic box whose color is "black") to newColor
end try
try
tell every picture box
set color of (every image whose color is "black") to newColor
end tell
end try
try
set color of frame of (every text box whose properties of frame contains "black") to newColor
end try
try
set color of frame of (every picture box whose properties of frame contains "black") to newColor
end try
try
set box type of (every picture box whose name is "graphic") to «constant BXTYNONT»
end try
end tell
Can you please use the Applescript code button when posting? That makes life easier.
I can’t find a more direct code than this one:
property colorExceptions : {"zwart", "cyaan", "magenta", "geel", "Registratie", "wit"}
tell application "QuarkXPress Passport"
if not (exists document 1) then return
tell document 1
set colorList to (name of every color spec) as list
set currentColorList to {}
repeat with thisItem in colorList
if thisItem is not in colorExceptions then
set end of currentColorList to (thisItem as text)
end if
end repeat
end tell
end tell
currentColorList
Your information was very helpfull. I managed to get a popscreen wich let me choice a new color for black, but when i choice the new color quark crashes all the time :(.
Maby you can look it over for me again.
Thanks
property colorExceptions : {"black", "cyan", "magenta", "yellow", "registration", "white"}
tell application "QuarkXPress Passport"
activate
if not (exists document 1) then return
tell document 1
set colorList to (name of every color spec) as list
set currentColorList to {}
repeat with thisItem in colorList
if thisItem is not in colorExceptions then
set end of currentColorList to (thisItem as text)
end if
end repeat
beep
set newColor to (choose from list colorList) as text
try
set name of every graphic box to "graphic"
set box type of every graphic box to picture box type
end try
try
tell every text box
set color of (every character whose color is "black") to newColor
end tell
end try
try
set color of (every generic box whose color is "black") to newColor
end try
try
tell every picture box
set color of (every image whose color is "black") to newColor
end tell
end try
try
set color of frame of (every text box whose properties of frame contains "black") to newColor
end try
try
set color of frame of (every picture box whose properties of frame contains "black") to newColor
end try
try
set box type of (every picture box whose name is "graphic") to «constant BXTYNONT»
end try
end tell
end tell
beep
Same here. It crashes. But also some other things which might not be correct.
This ones converts lines to boxes. Is that what you want? They will be deleted if the line is thin…
Is this what you want to do with all the colors in colorExceptions?
Than it could be better to set up a repeat-loop like:
repeat with theColor in colorExceptions
try
set color of (every character whose color is theColor) to newColor
--including the other actions to do.
end try
end repeat
To check where Quark crashes disable all the actions but one. Than add a next one after trying.
Another option is to disable the try/end try around an action: than an error might appear.
It seems i managed true it :D. It works for me now, but it’s for dutch only. By simply renaming the colors it can be used for every disired language.
Only items wich will not be changed are colorized tiff. I hope i can sort it out how to change this allso.
property colorExceptions : {"Zwart", "Cyaan", "Magenta", "Geel", "Registratie", "Wit"}
tell application "QuarkXPress Passport"
activate
if not (exists document 1) then return
tell document 1
set colorList to (name of every color spec) as list
set currentColorList to {}
repeat with thisItem in colorList
if thisItem is not in colorExceptions then
set end of currentColorList to (thisItem as text)
end if
end repeat
beep
set newColor to (choose from list colorList) as text
try
set name of every graphic box to "graphic"
end try
try
tell every text box
set color of (every character whose color is "Zwart") to newColor
end tell
end try
try
set color of (every generic box whose color is "Zwart") to newColor
end try
try
tell every picture box
set color of (every image whose color is "Zwart") to newColor
end tell
end try
try
set box type of (every picture box whose name is "graphic") to «constant BXTYNONT»
end try
end tell
end tell
beep
Sorry for the lack of reaction, but I was pretty busy last days. Here is a solution to change the color of the images.
First it makes a list of references to every picture box, then checks for the name of the color (instead of just the color like in your script).
The second option I put here is to work with a do script command. This increases the speed of your scripts a lot.
Number 1:
set newcolor to "magenta"
tell application "QuarkXPress Passport"
tell document 1
set everyImage to (object reference of every picture box)
repeat with i in everyImage
tell i
set thecolor to (name of color of image 1)
if thecolor is "zwart" then
set color of image 1 to newcolor
end if
end tell
end repeat
end tell
end tell
And number 2:
property newcolor : "magenta"
tell application "QuarkXPress Passport"
do script {changeColor}
end tell
script changeColor
tell document 1 of application "QuarkXPress Passport"
set everyImage to (object reference of every picture box)
repeat with i in everyImage
tell i
set thecolor to (name of color of image 1)
if thecolor is "zwart" then
set color of image 1 to newcolor
end if
end tell
end repeat
end tell
end script