I am an Applescripting novice, but I did not think I was a complete idiot until attempting to write this particular script.
I work at a print shop. Several of our corporate accounts order business cards on a regular basis. I have set up a FileMaker Pro database with their names and etc. Part of the database automatically applies Xpress tags to the different sections of text so that when imported to the appropriate template, style sheets are applied and the formatting is complete.
Here’s my problem: I can get the script to activate Quark and even to open the template, but I can’t seem to find the magic combination that allows me to select the first text box. I’ve tried …select text box [1] of page [1]… but keep getting the error message “access not allowed”. This is really kicking my ass, especially since I’m sure I’m missing something really fundamental.
Help!!
You can set the selection of any item in Quark ‘Set selected of text box 1 to true’ id the text box has a name then you can reference it by ‘Set selected of text box “Fred” to true’
You can also set the text of a text box with out having it selected first. In the example below the text of text box 1 will be set to “A little test” the string can be replaced with a variable or a file reference.
tell application "QuarkXPress™ 4.11"
tell document 1
tell page 1
set story 1 of text box 1 to "A little test"
end tell
end tell
end tell
From the your email you are placing XpressTags around the data first in witch case you will need to set an application preference in order to import the data with and read the tags as you want. The application preference you need to set is “import styles” to true. By the nature of you using XpressTags you will also need to write the data to a text file first otherwise Quark will not type set the text correctly (this is only due to the fact that you are using XpressTags).
Thanks so much! Now I am getting very close. In reference to the text file issue, this problem is actually in the second half of my script. The first half runs the exported text thru Word replacing tabs with returns and saves as a text file. When the Quark half kicks in it opens a template which was saved with the “include style sheets” box clicked and I have it opening with ‘use doc prefs yes’.
I am making progress thanks to the suggestions. I chose the ‘set story 1 of text box 1 of page 1 of document 1 to “file path”’ option, but all that gets me is the text inside the quotation marks. I’ve tried …to file “(file pate)” but then I get error messages.
So… I must not have a handle on the correct syntax for a file reference. I would appreciate any help. Meanwhile, I’m off to search the internet for possible answers…
chris
Chris here is a the syntax that I use to get a text file into a Quark text box:
[cdoe]tell application “QuarkXPress™ 4.11”
tell document 1
set story 1 of text box 1 of page 1 to alias “Bart:test”
end tell
end tell
That’s it!
Many thanks to you guys! I hope I am able to contribute to this forum in the future as a helper…
Thanks Again!
Hi Chris…this is my first time on the bbs Applescript forum. Your problem is exactly what i was looking for. I also work at a print shop, and we have corporate accounts. Most of the time though, Im stuck typesetting all the business cards…is there any way you can email me your script so i can check it out?? Does it really work??? Or is there typesetting still to be done??? I have no idea where to begin. I just started exploring the world of Applescript.