Nightstalker
ctrl+alt+del
|
Hi Leute, ich hab hier ein Apple Script, genauer gesagt eines für XPress 6.5, eines der Standardscripts von Xpress. Nun bräuchte ich aber 2 "kleine" Modifikationen. Ums auf den Punkt zu bringen, das Script erzeugt einen "Schatten" für eine "Box" (Drop Shadows heißt es), man kann einstellen welche Boxen er verändert, H u. V Versatz für das Schattenkästchen und Füllfarbe der vorderen Box. Soweit ok aber ABER: Ich brauche ein Auswahlmenü bei dem ich die SCHATTENFARBE auswählen kann (4 verschieden Farben) und eine Eingabeaufforderung wo ich den Tonwert einstellen kann. Ich hab es geschafft im Script den Tonwert zu ändern aber die Farbe schaff ich beim besten Willen nicht, die is zwar in CMYK angegeben nur steht da z.B. für Black: (0, 0, 0, 65535) damit kann ich nix anfangen, wenn ich den letzten Wert auf 0 setz is es weiß das würd noch passen aber was ist diese elendslange Zahl?! Wenn ich sie ändere kommt eine Fehlermeldung Tja und das mit den Menüs versteh ich auch nicht, diese Applescripts sind irgendwie nicht meins. Hier der original Scriptcode: (*
Copyright © 1994-2003 - All Rights Reserved
Quark, Inc. & Nyhthawk Productions
[url]http://www.Quark.com[/url]
[url]http://members.aol.com/nyhthawk/welcome.html[/url]
Copying and sharing of this script in whole or in part is allowed. The authors are
not responsible for any losses caused by the use of or failure of this software.
*)
-- This section will specify the default offset values for the shadow boxes
global yoffset
property yoffset : 9
global xoffset
property xoffset : 9
global overprintTrap
on run {}
tell application "QuarkXPress Passport"
activate
try
-- This line will ensure that a document is open before proceeding
if not (exists document 1) then error "No document exists."
-- This section will ask the user if they want to delete previously created drop shadows
tell document 1
-- This line will display an error if the current page is a master page
if masterdoc is true then error "This script doesn't work on master pages."
-- This line will ensure that a document is open before proceeding
if not (exists generic box 1) then error "No boxes exists."
set theSel to {button returned:"No"}
if exists (graphic box 1 whose name is "Shadow Box") then
set theSel to (display dialog "Would you like to delete previous shadows?" buttons {"Cancel", "Keep", "Delete"} default button "Delete")
-- For compatibility with non-US English operating systems
if button returned of result is "Cancel" then error "User canceled." number -128
end if
-- This section will ask the user for what type of boxes to create drop shadows
if (exists current box) and box type of current box ≠ line box type then
set BoxTypes to {"Selected Box(es)", "Picture Boxes", "Text Boxes", "None Boxes"}
set SelectedBoxTypes to (choose from list BoxTypes with prompt "Select desired box types." & return & ¬
"Multi-select with Shift or Command." default items {"Selected Box(es)"} cancel button name "Cancel" with multiple selections allowed without empty selection allowed)
else
set BoxTypes to {"Picture Boxes", "Text Boxes", "None Boxes"}
set SelectedBoxTypes to (choose from list BoxTypes with prompt "Select desired box types." & return & ¬
"Multi-select with Shift or Command." default items {"Picture Boxes"} cancel button name "Cancel" with multiple selections allowed without empty selection allowed)
end if
-- This line will terminate the script if the user cancels the dialog
if SelectedBoxTypes is false then return
-- This section will allow the user to specify the vertical offset values for the shadow boxes
set yoffset to (display dialog "Number of points for the Vertical shadow offset:" default answer yoffset)
-- For compatibility with non-US English operating systems
if button returned of yoffset is "Cancel" then error "User canceled." number -128
set yoffset to text returned of yoffset as real
-- This section will allow the user to specify the horizontal offset values for the shadow boxes
set xoffset to (display dialog "Number of points for the Horizontal shadow offset:" default answer xoffset)
-- For compatibility with non-US English operating systems
if button returned of xoffset is "Cancel" then error "User canceled." number -128
set xoffset to text returned of xoffset as real
-- This section will ask the user if the background trap for the box should be set to overprint
-- If the background trap is set to overprint, it will print as if the background items are appearing through the shadow
set overprintTrap to button returned of (display dialog "How would you like the shadow boxes to be trapped?" buttons {"Cancel", "Default Trap", "Overprint"} default button "Overprint")
if overprintTrap is "Overprint" then
set overprintTrap to overprint
else if overprintTrap is "Default Trap" then
set overprintTrap to default
else if overprintTrap is "Cancel" then
-- For compatibility with non-US English operating systems
error "User canceled." number -128
end if
-- This section will make a list of all the specified boxes, and send the list to the MakeShadow() handler
if button returned of theSel is "Delete" then delete (every generic box whose name is "Shadow Box")
-- This section will store the old item spread coords and set the Item Coordinates preference to Spread
set oldCoords to item spread coords
set item spread coords to true
set theListOfBoxes to {}
if length of SelectedBoxTypes is 4 then
try
set theListOfBoxes to the object reference of every generic box
on error errmsg number errnum
error errmsg number errnum
end try
my MakeShadow(theListOfBoxes)
else
repeat with i in SelectedBoxTypes
if i as text is "Selected Box(es)" then
try
set theListOfBoxes to theListOfBoxes & (the object reference of every generic box whose selected is true)
end try
else if i as text is "Picture Boxes" then
try
set theListOfBoxes to theListOfBoxes & (the object reference of every picture box whose box shape is not polygonal)
end try
else if i as text is "Text Boxes" then
try
set theListOfBoxes to theListOfBoxes & object reference of every text box
end try
else if i as text is "None Boxes" then
try
set theListOfBoxes to theListOfBoxes & (object reference of (every graphic box whose name is not "Shadow Box" and box shape is not «constant TPBXPBRL»))
end try
end if
end repeat
if length of theListOfBoxes is 0 then
error "No boxes match the selected criteria."
end if
my MakeShadow(theListOfBoxes)
end if
-- This line will return Item Coordinates to its original setting
set item spread coords to oldCoords
-- The following beeps will notify the user that the script is complete
beep 2
end tell
on error errmsg number errnum
try
set item spread coords to oldCoords
end try
if errnum ≠ -128 then
beep
display dialog errmsg & " [" & errnum & "]" buttons {"OK"} default button 1 with icon stop
end if
-- For compatibility with non-US English operating systems
return
end try
end tell
end run
--=================================== Handlers =========================================
-- Below is the handler (subroutine) that is called from the 'on run()' handler
--=====================================================================================
on MakeShadow(theListOfBoxes)
FixColor(theListOfBoxes)
tell application "QuarkXPress Passport"
set var_BlackColor to (name of color spec 1 of document 1 whose locked is true and CMYK color value = {0, 0, 0, 65535}) as text
-- The following line will make a list out of a single item
if class of theListOfBoxes is not list then ¬
copy (coerce theListOfBoxes to list) to theListOfBoxes
-- The following line will reverse the list of references,
-- so that the new boxes won't throw off the box count for boxes that are yet to be created
set theListOfBoxes to reverse of theListOfBoxes
-- The following section will make sure that the box is not a line shape,
-- then create the new shadow box
repeat with i from 1 to the number of items of theListOfBoxes
set boxShape to get box shape of item i of theListOfBoxes
if boxShape is not in {polygonal, line shape, orthogonal line, spline line} then
set boxAngle to rotation of (item i of theListOfBoxes)
set boxskew to skew of (item i of theListOfBoxes)
if boxAngle as real ≠ 0 or boxskew as real ≠ 0 then
-- This section will straighten the box so it can get the accurate bounds and then rotate it and skew it as appropriate
set properties of (item i of theListOfBoxes) to {rotation:0, skew:0}
copy (coerce (bounds of (item i of theListOfBoxes) as points rectangle) to list) to {a, b, c, d}
set properties of (item i of theListOfBoxes) to {rotation:boxAngle, skew:boxskew}
else
copy (coerce (bounds of (item i of theListOfBoxes) as points rectangle) to list) to {a, b, c, d}
end if
set cornerRadius to corner radius of item i of theListOfBoxes
-- This section will make the shadow boxes
if cornerRadius is null then
make new graphic box at after (item i of theListOfBoxes) with properties ¬
{bounds:{(a as real) + yoffset, (b as real) + xoffset, (c as real) + yoffset, (d as real) + xoffset} as points rectangle, name:"Shadow Box", color:var_BlackColor, shade:15, box shape:boxShape, rotation:boxAngle, skew:boxskew, background trap:overprintTrap}
else
make new graphic box at after (item i of theListOfBoxes) with properties ¬
{bounds:{(a as real) + yoffset, (b as real) + xoffset, (c as real) + yoffset, (d as real) + xoffset} as points rectangle, name:"Shadow Box", color:var_BlackColor, shade:30, box shape:boxShape, rotation:boxAngle, skew:boxskew, background trap:overprintTrap, corner radius:(get corner radius of item i of theListOfBoxes)}
end if
else
beep
display dialog "Drop Shadows can not be created for Lines or Bezier boxes." buttons {"Cancel", "Continue"} default button "Continue" with icon caution
-- For compatibility with non-US English operating systems
if button returned of result is "Cancel" then return
end if
end repeat
end tell
end MakeShadow
--=================================== Handlers =========================================
-- Below is the handler (subroutine) that is called from the 'MakeShadow()' handler.
--=====================================================================================
on FixColor(theListOfBoxes)
tell application "QuarkXPress Passport"
set var_WhiteColor to (name of color spec 1 of document 1 whose locked is true and CMYK color value = {0, 0, 0, 0}) as text
set lang to language
if lang is Danish then
set colorName to "Ingen"
else if lang is Dutch then
set colorName to "Geen"
else if lang is French then
set colorName to "Aucun(e)"
else if lang is German then
set colorName to "Kein"
else if lang is Reformed German then
set colorName to "Kein"
else if lang is International English then
set colorName to "None"
else if lang is Italian then
set colorName to "Nessuna"
else if lang is Norwegian then
set colorName to ""
else if lang is Spanish then
set colorName to "Ninguno"
else if lang is Swedish then
set colorName to "Ingen"
else if lang is Swiss German then
set colorName to "Kein"
else if lang is US English then
set colorName to "None"
end if
set displayFlag to true
set ColorList to name of every color spec of document 1
repeat with i from 1 to the number of items of theListOfBoxes
set theBox to item i of theListOfBoxes
set boxColor to (get color of theBox)
set boxColorName to (get name of color of theBox)
if boxColorName is colorName then
if displayFlag is true then
beep
set theSel to (display dialog "The drop shadow script doesn't work with None colored boxes. Do you want to change its color?" buttons {"Cancel", "Don't Change", "OK"} default button "OK")
if button returned of theSel is "Don't Change" then return
-- Choose color from the list
set desiredBoxColor to (choose from list ColorList with prompt "Select a color to apply to None colored boxes:" default items {var_WhiteColor} without multiple selections allowed and empty selection allowed)
if desiredBoxColor is false then
return
else
set desiredBoxColor to item 1 of desiredBoxColor
end if
set displayFlag to false
end if
-- Change the None color to boxColor
set color of theBox to desiredBoxColor
end if
end repeat
end tell
end FixColor
Vielleicht kann mir wer helfen!?
tia
MfG
Bearbeitet von Nightstalker am 13.12.2004, 14:41
|
Dimitri
PerformanceFreak
|
z.B. für Black: (0, 0, 0, 65535) damit kann ich nix anfangen, wenn ich den letzten Wert auf 0 setz is es weiß das würd noch passen aber was ist diese elendslange Zahl?! Wenn ich sie ändere kommt eine Fehlermeldung Ich tippe mal auf R,G,B (16bit, also rund 65.000 Farben) Demnach könnte zb 255,255,255,65535 Weiß sein ... oder? (den letzten Wert darfst jedenfalls bestimmt nicht beliebig ändern!) Ansonsten fällt mir spontan nichts ein! hth
|
gue
Addicted
|
Vielleicht hilft dir das: http://de.wikipedia.org/wiki/CMYKDer letzte Wert ist anscheinend der Schwarz-Anteil. (0,0,0,0) steht also für Weiß. 65535 ist (2^16)-1, der Schwarz-Anteil wird also wahrscheinlich mit einem Wert von 0-65535 angegeben.
|
Dimitri
PerformanceFreak
|
Vielleicht hilft dir das: http://de.wikipedia.org/wiki/CMYK Der letzte Wert ist anscheinend der Schwarz-Anteil. (0,0,0,0) steht also für Weiß. 65535 ist (2^16)-1, der Schwarz-Anteil wird also wahrscheinlich mit einem Wert von 0-65535 angegeben. was ist diese elendslange Zahl?! Wenn ich sie ändere kommt eine Fehlermeldung Wenn dem wirklich so ist, kanns dieser Lösungsansatz leider nicht sein ...
|
gue
Addicted
|
Wenn dem wirklich so ist, kanns dieser Lösungsansatz leider nicht sein ... Er hat die Fehlermeldung nicht gepostet also wie kannst du dir so sicher sein? Vielleicht hat er ja Werte jenseits der 65535 probiert oder es sind z.B. nur Vielfache von 8 (-1) gültig. Dass der letzte Wert ein 16-Bit RGB Wert ist, halte ich für ausgeschlossen (sonst würde wohl CYMRGB (was es nicht gibt und jedem Sinn entbehrt) statt CMYK dastehen).
|
watchout
Legendundead
|
auf jeden fall scheint osx mit 16bit farben zu rechnen, was auch zu den 64bit prozessoren passt... (die ganzen farbauswahl sachen sind in 16bit, man kann aber auch 8bit auswählen) nightstalker, bitte mach' ein [php] tag um den code herum wirklich helfen kann ich noch nicht, ich hab mein baby selbst erst seit weniger als einer woche...
|
Nightstalker
ctrl+alt+del
|
So habs getaged, leider funkt da beim Forum wieder was nicht, normal müsst ich ja ne Benachrichtigung bekommen und es müsst in meinen Subscribed Threads aufscheinen, tuts aber nicht So zur Fehlermeldung: das gleiche kommt auch wenn ich einen der anderen Werte ändere. Imho hängt das irgendwie mit dem was im restlichen Code steht zusammen ich weiß aber leider auch ned recht was damit anzufangen. Bin auch leider kein coder sonst wärs sicher einfacher
|
mr.nice.
differential image maker
|
hm ich kenn mich zwar selbst nicht sonderlich aus, aber wie wärs wennst dir eine neue variable definierst ? momentan schauts ja so aus:
set var_BlackColor to (name of color spec 1 of document 1 whose locked is true and CMYK color value = {0, 0, 0, 65535}) as text
änder das ganze mal in
set var_WhiteColor to (name of color spec 1 of document 1 whose locked is true and CMYK color value = {0, 0, 0, 0}) as text
und schau was passiert..
|
Nightstalker
ctrl+alt+del
|
nö ich glaub nicht dass es an der variable liegt, die kann auch lila sein und schwarz heißen, wenn dann liegt es an dem teil der danach kommt, möglicherweise bezieht er sich da nämlich auf die im Dokument FIXIERTE Farbe Schwarz, jedenfalls is das komisch.
|