Re: Quark & Applescript
Re: Quark & Applescript
- Subject: Re: Quark & Applescript
- From: Hans Haesler <email@hidden>
- Date: Wed, 8 Nov 2000 09:28:26 +0100
On Wed, 08 Nov 2000, Shane Stanley wrote:
>
tell application "QuarkXPress 4.11"
>
tell document 1
>
set x to object reference of (text box 1 whose selected is true)
>
set y to offset of character -1 of line -1 of x
>
save text from character 1 to character (y + 1) of x in "Macintosh HD:Some
>
text"
>
end tell
>
end tell
This doesn't work for me when there is only one selected box.
The error message (in French :-( says something about the data
not being in the expected type and 'object reference' is selected.
And how do you make sure that you get the aimed box? Another error
is generated when the box is not the first one of linked boxes.
So, I tried this:
---
tell document 1 of application "QuarkXPress 4.11"
tell current box
save (text from first line to line -1) in "Macintosh HD:Sometext.txt"
end tell
end tell
---
But, of course, I should insert a test to make sure that there is
only _one_ selected box, and that it is a text box and that a
document is open and that the selected box is not on a Master page,
else you cut (temporarily, i.e. you must quit XPress and launch it
again) the link to 'current box'...
---
tell application "QuarkXPress 4.11"
activate
if (exists of document 1) is false then
display dialog "Please open an XPress document first." buttons ,
"OK" default button 1 with icon 2
error number -128
else
if current page is null then
display dialog "You are looking at a Master page.
Please switch to a Document page." buttons "OK" default button 1 with icon 0
error number -128
end if
end if
tell document 1
tell current box
try
set boxType to box type as text
on error
display dialog "There is no selected box." buttons ,
"OK" default button 1 with icon 2
error number -128
end try
if boxType = "GRPx" then
display dialog "Don't select more than one box." buttons ,
"OK" default button 1 with icon 2
error number -128
else if boxType is not "TXTx" then
display dialog "Select a T E X T box, please." buttons ,
"OK" default button 1 with icon 2
error number -128
end if
save (text from first line to line -1) in "Macintosh HD:Sometext.txt"
end tell
end tell
end tell
---
I don't insert the test which makes sure that XPress is running
because I run most of my scripts from OSA Menu.
Hans
---
Hans Haesler | email@hidden