Text extraction from QuarkXPress - file permissions error

I’ve written a simple script to extract text from every text box in a QXP 6.5 document and write it to a text file.

Problem is that I get the following error when I attempt to run the script:

“QuarkXPress got an error: File permission error”

Any idea what I’m doing wrong - script below? I’d be grateful for any help.


tell application “QuarkXPress”
repeat with i from 1 to (count of text boxes) of document 1
set my_words to contents of text box i of document 1
my filewriter(the_file, my_words)
end repeat
end tell

on filewriter(the_file, my_words)
close access file the_file
end try
open for access the_file with write permission
write my_words to file the_file starting at eof
close access the_file

end filewriter

Tom -

“the_file” doesn’t appear to be initialized to anything. When you set it, bear in mind that it requires a file alias here, not just a text string, e.g.,

set the_file to alias "path:to:file"
  • Dan