Hallo Mike,
und hier ist eine erste Lösung. Schon recht komfortabel, kannst Du im Script das Ausrechnen der
Abstände steuern, indem Du die als 'property' definierte Variable 'boxDistance' auf "enger", "mittel"
oder "weiter" setzest.
Was bedeuten diese drei Ausdrücke?
Mit "enger" wird die Anzahl der zu setzenden Kästchen auf die nächsthöhere Ganzzahl aufgerundet.
Egal, ob 5.12 oder 5.92: Beide werden zu 6.
Mit "mittel" werden Dezimalstellen von 0.5 und höher aufgerundet. Darunter wird abgerundet.
Mit "weiter" wird die Anzahl der zu setzenden Kästchen auf die nächstkleinere Ganzzahl abgerundet.
Die genannten 5.12 und 5.92 werden beide zu 5.
Je nach Dimension des Layouts wird zwischen "mittel" und "weiter" kein Unterschied zu sehen sein.
Aber mit dem von Dir genannten Format von 300 x 125 mm (und einem gewünschten Abstand von
50 mm) schon.
Die Properties 'boxH' und 'boxW' dienen zum Bestimmen der Boxenhöhe und -breite. Mit 'boxC'
definiert man die Distanz vom Seitenrand zur Boxenmitte und mit 'fillColor' die Hintergrundfarbe.
property boxDistance : "enger"
--property boxDistance : "mittel"
--property boxDistance : "weiter"
property boxH : 0.5
property boxW : 0.5
property boxC : 2
property fillColor : "Schwarz"
global decSep
set decSep to ""
try
[nbsp] "1.5" as real
[nbsp] set decSep to "."
on error
[nbsp] set decSep to ","
end try
tell document 1 of application "QuarkXPress 6.1"
[nbsp] set tmpVal to text returned of (display dialog "Abstand der Kästchen (in mm):" default answer "")
[nbsp] set stepVal to ""
[nbsp] repeat with i from 1 to count of tmpVal
[nbsp] [nbsp] set curChar to character i of tmpVal
[nbsp] [nbsp] if curChar is in "0123456789" then
[nbsp] [nbsp] [nbsp] set stepVal to stepVal & curChar
[nbsp] [nbsp] else if curChar is in ",." then
[nbsp] [nbsp] [nbsp] set stepVal to stepVal & decSep
[nbsp] [nbsp] else
[nbsp] [nbsp] [nbsp] display dialog "Die Eingabe für den Abstand ist ungültig.
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] [nbsp]
Du hast getippt: " & tmpVal buttons "OK" default button 1 with icon 0
[nbsp] [nbsp] [nbsp] error number -128
[nbsp] [nbsp] end if
[nbsp] end repeat
[nbsp] if not (color spec fillColor exists) then
[nbsp] [nbsp] set fillColor to name of color spec 1 whose locked = true and RGB color value = {0, 0, 0}
[nbsp] end if
[nbsp] set pageWidth to page width as millimeter units as real
[nbsp] set pageHeight to page height as millimeter units as real
[nbsp] set xMargin to boxC - (boxW / 2)
[nbsp] set yMargin to boxC - (boxH / 2)
[nbsp] set ty1 to yMargin
[nbsp] set by1 to pageHeight - yMargin - boxH
[nbsp] set x1 to xMargin
[nbsp] set lastX1 to pageWidth - xMargin - boxW
[nbsp] set lastY1 to by1
[nbsp] set totX to lastX1 - x1
[nbsp] set totY to lastY1 - ty1
[nbsp] set tmpXVal to (totX / stepVal)
[nbsp] set tmpYVal to (totY / stepVal)
[nbsp] if boxDistance is "enger" then
[nbsp] [nbsp] if not ((tmpXVal as string) ends with ".0") then
[nbsp] [nbsp] [nbsp] set nBoxesH to (tmpXVal + 1) div 1
[nbsp] [nbsp] else
[nbsp] [nbsp] [nbsp] set nBoxesH to tmpXVal div 1
[nbsp] [nbsp] end if
[nbsp] [nbsp] if not ((tmpYVal as string) ends with ".0") then
[nbsp] [nbsp] [nbsp] set nBoxesV to (tmpYVal + 1) div 1
[nbsp] [nbsp] else
[nbsp] [nbsp] [nbsp] set nBoxesV to tmpYVal div 1
[nbsp] [nbsp] end if
[nbsp] else if boxDistance is "mittel" then
[nbsp] [nbsp] set nBoxesH to (tmpXVal + 0.5) div 1
[nbsp] [nbsp] set nBoxesV to (tmpYVal + 0.5) div 1
[nbsp] else if boxDistance is "weiter" then
[nbsp] [nbsp] set nBoxesH to tmpXVal div 1
[nbsp] [nbsp] set nBoxesV to tmpYVal div 1
[nbsp] else
[nbsp] [nbsp] display dialog "Die Einstellung \"" & boxDistance & "\" ist nicht vorgesehen." buttons [nbsp]¬
[nbsp] [nbsp] [nbsp] "OK" default button 1 with icon 0
[nbsp] [nbsp] error number - 128
[nbsp] end if
[nbsp] set defXstep to totX / nBoxesH
[nbsp] set defYstep to totY / nBoxesV
[nbsp] tell page 1
[nbsp] [nbsp] try
[nbsp] [nbsp] [nbsp] delete (every graphic box whose name is "blackBox")
[nbsp] [nbsp] end try
[nbsp] [nbsp] repeat with i from 1 to nBoxesH + 1
[nbsp] [nbsp] [nbsp] make graphic box at beginning with properties [nbsp]¬
[nbsp] [nbsp] [nbsp] [nbsp] {bounds:{"" & ty1 & "mm", "" & x1 & "mm", "" & (ty1 + boxH) & "mm", "" & (x1 + boxW) & "mm"} [nbsp]¬
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] , color:fillColor, shade:100, name:"blackBox"}
[nbsp] [nbsp] [nbsp] make graphic box at beginning with properties [nbsp]¬
[nbsp] [nbsp] [nbsp] [nbsp] {bounds:{"" & by1 & "mm", "" & x1 & "mm", "" & (by1 + boxH) & "mm", "" & (x1 + boxW) & "mm"} [nbsp]¬
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] , color:fillColor, shade:100, name:"blackBox"}
[nbsp] [nbsp] [nbsp] set x1 to x1 + defXstep
[nbsp] [nbsp] end repeat
[nbsp] [nbsp] set x1 to xMargin
[nbsp] [nbsp] repeat with i from 2 to nBoxesV
[nbsp] [nbsp] [nbsp] set ty1 to ty1 + defYstep
[nbsp] [nbsp] [nbsp] make graphic box at beginning with properties [nbsp]¬
[nbsp] [nbsp] [nbsp] [nbsp] {bounds:{"" & ty1 & "mm", "" & x1 & "mm", "" & (ty1 + boxH) & "mm", "" & (x1 + boxW) & "mm"} [nbsp]¬
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] , color:fillColor, shade:100, name:"blackBox"}
[nbsp] [nbsp] [nbsp] make graphic box at beginning with properties [nbsp]¬
[nbsp] [nbsp] [nbsp] [nbsp] {bounds:{"" & ty1 & "mm", "" & lastX1 & "mm", "" & (ty1 + boxH) & "mm", "" & (lastX1 + boxW) & "mm"} [nbsp]¬
[nbsp] [nbsp] [nbsp] [nbsp] [nbsp] , color:fillColor, shade:100, name:"blackBox"}
[nbsp] [nbsp] end repeat
[nbsp] end tell
end tell
Das Script "Kaestchen_6x_01d" ist unterwegs zu Dir.
Gruss, Hans