Hallo Andreas,
also ich würde es mir nochmals überlegen. Denn: auch AS kann süchtig machen. ;-)
Nun zu Deiner Frage. Beim Prüfen der Syntax erhalte ich mit QuarkXPress 4.11 eine Fehlermeldung. Ich muss 'last page' in 'page -1' ändern, damit der Code akzeptiert wird. Eigenartigerweise geht 'last text box' durch. Aber mit 'text box -1' ist es einheitlicher. Ich ziehe auch vor, die Objekte direkt anzusprechen und 'of' zu vermeiden. Dadurch gibt es kürzere und lesbarere Zeilen:
---
tell document 1 of application "QuarkXPress 4.11"
tell page -1
tell text box -1
set {TBO, TBL, TBU, TBR} to bounds as list
end tell
end tell
end tell
---
Dein Ergebnis {"12,7 mm", "12,7 mm", "38,7 mm", "96,709 mm"} sieht aus wie eine Liste von Strings, ist es aber nicht. Wenn Du am Ende des Scripts den Befehl 'class of TBO' einfügst, dann ist das Ergebnis 'vertical measurement', also eine Konstante.
Die Werte, welche man verändern will, muss man umwandeln und zwar in Bruchzahlen. Dazu benötigt man den Zusatz 'as real'.
---
tell document 1 of application "QuarkXPress 4.11"
tell page -1
tell text box -1
set {TBO, TBL, TBU, TBR} to bounds as list
set TBU to TBU as real
set TBR to TBR as real
set bounds to {TBO, TBL, TBU + 5, TBR + 5}
end tell
end tell
end tell
tell document 1 of application "QuarkXPress 4.11"
set mes to 0
set vMes to vertical measure
set hMes to horizontal measure
if vMes is not millimeters or hMes is not millimeters then
set mes to 1
set properties to {vertical measures, horizontal measures}
end if
--
-- Hier Scriptbefehle, welche mit Millimeter-Werten ohne Masseinheits-Kürzel auskommen
--
if mes = 1 then set properties to {vertical measure:vMes, horizontal measure:hMes}
end tell
---
Der 'flag' mes wird auf '1' gesetzt, falls die Masseinheiten nicht 'Millimeter' sind. Am Schluss wird der Wert von 'mes' geprüft und entsprechend gehandelt.
Hans Haesler <hsa@ringier.ch>