Setting up a script that basically takes the text from multiple text files and copies them each into a single text box in another document. The files in question always have the text box in the same position on the page so identifying the text boxes is easy. I have had difficulty copying and pasting in when scripting Quark before so I figured I would check to see if anyone has a better way than how I am going. The main concern is that I want to keep all of the text formatting of the text I am copying when I paste it into the new doc. I tried setting a variable to the text but that stripped the text of its formatting. Here is the main Quark part of what I have. This works although I am not sure yet how I would copy the next part and append it to the text box.
Quark 6.5 OS 10.3.9
tell application "QuarkXPress"
activate
--Open template, find main text box, name it so it can be referenced, delete what is in there, save as
open file PathToTemplate use doc prefs yes remap fonts ask do auto picture import yes
tell front document
set tool mode to drag mode
tell page 1
repeat with Countr from 1 to count of text boxes
tell text box Countr
copy (right of bounds of it as real) to YCoord
if YCoord is greater than 0.25 then
set name of it to ("MainTextBox")
set story 1 of it to ""
exit repeat
end if
end tell
end repeat
end tell
end tell
save front document in file (PathToDesktop & MainFileName & ".qxp") without template and include preview
close front document
--Open file with text to copy, identify text box, name it, select text in text box and copy it with command-C
open file (PathToPart1 & PartOneFile & ".qxp") use doc prefs yes remap fonts ask do auto picture import yes
delay 3
tell front document
set tool mode to contents mode
tell page 1
repeat with Countr from 1 to count of text boxes
tell text box Countr
copy (top of bounds of it as real) to YCoord
if YCoord is greater than 1 and YCoord is less than 2 then
set name of it to ("ThisBox")
exit repeat
end if
end tell
end repeat
delay 0.5
select paragraph 1 of story 1 of text box "ThisBox"
tell application "System Events"
keystroke "c" using {command down}
end tell
end tell
end tell
close front document saving no
--Open main doc again, paste into text box followed by a return to set up next paragraph
open file (PathToDesktop & CCMNumber & FileVersion & ".qxp") use doc prefs yes remap fonts ask do auto picture import yes
tell front document
set tool mode to contents mode
tell page 1
select story 1 of text box "MainTextBox"
tell application "System Events"
keystroke "v" using {command down}
keystroke return
end tell
end tell
end tell
end tell
Model: Mac G5
Operating System: Mac OS X (10.3.9)