Hallo Seb,
weil das Bild in die aktive Box geladen werden soll, braucht sich das Script nicht um die Seite oder die
Arbeitsfläche zu kümmern. Aber es muss testen, ob eine Box ausgewählt ist, nur eine Box und zwar eine Bildbox.
Wenn alles okay ist, dann kann mit einem Dialog der Anwender aufgefordert werden, eine Bilddatei auszuwählen.
Die ausgewählte Box wird mit 'current box' bezeichnet:
---
tell application "QuarkXPress 4.11"
activate
if not (exists document 1) then
display dialog "Kein XPress Dokument geöffnet." buttons {"Ooooh!"} default button 1 with icon 0
error number -128
end if
try
set boxType to box type of current box
on error
display dialog "Es ist keine Box ausgewählt." buttons "OK" default button 1 with icon 2
error number -128
end try
if boxType = group box type then
display dialog ¬
"Bitte nur eine Box aufs Mal." buttons "OK" default button 1 with icon 2
error number -128
else if boxType is not picture box type then
display dialog "Bitte eine B I L D - Box auswählen." buttons "OK" default button 1 with icon 0
error number -128
end if
set aPicture to (choose file with prompt "Ein Bild wählen" of type {"TIFF", "EPSF", "JPEG"}) as string
tell current box
set image 1 to aPicture as alias
end tell
end tell
---
Der Zusatz 'of type {"TIFF", "EPSF", "JPEG"}' schränkt die Auswahl der gezeigten Dateien auf die genannten Typen
ein. Ohne diese Präzisierung würden auch Textdateien, XPress-Dokumente, unsichtbare Dateien usw. erscheinen.
Ich habe dieses Script nur unter Mac OS 9.2.2 ausprobiert.
Hans Haesler <hsa@ringier.ch>
als Antwort auf: [#418421]