Hi I’m trying to write a simple Quark script which will merge a number of text files into one Quark file:
on open fileList
tell application “Finder”
repeat with i in fileList
set filePath to i as string
end repeat
end tell
tell application “QuarkXPress™ 4.11”
activate
tell text box 1 of page 1 of document 1
repeat with i in fileList
set story 1 to alias (filePath)
end repeat
end tell
end tell
end open
Of course the–set paragraph 1 to alias (filePath)–simply keeps replacing one text file with another. How do I write it so the files are placed one after another?
: You shouldn’t. It works great on my machine. What version of Quark are you
: using? I wrote it for Quark 4.x
I’m using 4.11 on OS 9.04 with script editor 1.4.3 also tried it on a machine with 9.2.2.
When I compile I get --expected end of line but found class name–when it hits file. This is true no matter what I put after the import command.
: I’m using 4.11 on OS 9.04 with script editor 1.4.3 also tried it on a machine
: with 9.2.2.
: When I compile I get --expected end of line but found class name–when it
: hits file. This is true no matter what I put after the import command.
I actually remember the same thing happening to me in the debug process. I just can’t for the life of me remember what fixed it. Oh, wait, try retyping it in a new window, not pasting.
I’m also going to just email you a pre-compiled version of the script to try out. Just to be sure we understand the problem.
: Thanks for sending the script. I get an error when I run it–doesn’t
: understand the «event ScrMIMPT» message. Also, if I open the script it
: looks like this, which is probably not the way you wrote it: on open
: theFiles
Got it. My script seems to depend on ScriptMaster XT, a Quark scripting recordability extension. Although, it’s not supposed to do that. I have always been under the impression it’s scripts were portable. I have several scripts in production right now which were built on recorded scripts using ScriptMaster XT, but the users don’t have it installed.
: Got it. My script seems to depend on ScriptMaster XT, a Quark scripting
: recordability extension. Although, it’s not supposed to do that. I have
: always been under the impression it’s scripts were portable. I have
: several scripts in production right now which were built on recorded
: scripts using ScriptMaster XT, but the users don’t have it installed.
: Hmm. scratching his head
: T.J.
The command Import is part of scriptmaster dictionary not Quarks. Scriptmaster not only make quark somewhat recordable it also add to the dictionary.
: The command Import is part of scriptmaster dictionary not Quarks.
: Scriptmaster not only make quark somewhat recordable it also add to the
: dictionary.
Ah, maybe we should rename this thread Complicated Quark Script. Is there a way to do it with out the import command?
: I actually remember the same thing happening to me in the debug process. I
: just can’t for the life of me remember what fixed it. Oh, wait, try
: retyping it in a new window, not pasting.
: I’m also going to just email you a pre-compiled version of the script to try
: out. Just to be sure we understand the problem.
Thanks for sending the script. I get an error when I run it–doesn’t understand the «event ScrMIMPT» message. Also, if I open the script it looks like this, which is probably not the way you wrote it:
on open theFiles
repeat with i in theFiles
tell application “QuarkXPress™ 4.11”
activate
«event ScrMIMPT» file i given «class To »:text box 1 of spread 1 of document 1
end tell
end repeat
end open
Does this mean we’re working from different dictionaries?
: Ah, maybe we should rename this thread Complicated Quark Script. Is there a
: way to do it with out the import command?
Yes:
set text of text box 1 to theText
(where the “theText” can be either a string of text, or an alias to the text file.)
I once made a batch text imput droplet that imported text files into a newly created document. It worked well for me, but I haven’t used it in a while.
I’m sending this to to privately. If anyone else wants it, do give me a shout…
It should be a golden rule of scripting to always (write and) test scripts without third party add ons such as OSAXen, and in this case ScriptMaster. ScriptMaster does indeed add to the dictionary, and QXP scripts made using it could easily trip up once distributed…
Try testing scripts which are intended for distribution with a minimal default XTensions folder in place, and with only the default OSAXen installed. It takes a little time to do, but saves a lot! (from someone who has learnt from experience…!
set theFold to "bladder:text:" -- or whatever your base folder is
set theList to (choose from list (list folder (theFold)) with multiple selections allowed) --remove "choose" if you know
repeat with i in theList
set theFile to (theFold & (i))
set theText to (read file theFile)
end repeat
tell application "QuarkXPressª"
activate
set properties to {import styles:true}
tell document 1
set story 1 to theText
end tell
end tell
then you can do whatever you want with the text… split it up or whatever. setting the text you want to flow as a variable should do the trick. or you could write all the text to a new file (slower) and import that with styles, etc.
: Yes: set text of text box 1 to theText
: (where the “theText” can be either a string of text, or an alias to
: the text file.)
: I once made a batch text imput droplet that imported text files into a newly
: created document. It worked well for me, but I haven’t used it in a while.
: I’m sending this to to privately. If anyone else wants it, do give me a
: shout…
: It should be a golden rule of scripting to always (write and) test scripts
: without third party add ons such as OSAXen, and in this case ScriptMaster.
: ScriptMaster does indeed add to the dictionary, and QXP scripts made using
: it could easily trip up once distributed…
: Try testing scripts which are intended for distribution with a minimal
: default XTensions folder in place, and with only the default OSAXen
: installed. It takes a little time to do, but saves a lot! (from someone
: who has learnt from experience…!
: Cheers,
: Dave L.
Thanks Dave, This gets me back to the beginning. The problem isn’t getting the text, it’s placing the files sequentially. I was using–set story 1 to alias (filePath) and the script was simply replacing each text file with the next–same thing is happening with–set text of text box 1 to alias (filePath).
on open fileList
tell application “Finder”
repeat with i in fileList
set filePath to i as string
end repeat
end tell
tell application “QuarkXPress™ 4.11”
activate
tell page 1 of document 1
set text of text box 1 to alias (filePath)
end tell
end tell
end open
: Thanks Dave, This gets me back to the beginning. The problem isn’t getting
: the text, it’s placing the files sequentially. I was using–set story 1 to
: alias (filePath) and the script was simply replacing each text file with
: the next–same thing is happening with–set text of text box 1 to alias
: (filePath).
: on open fileList
: tell application “Finder”
: repeat with i in fileList
: set filePath to i as string
: end repeat
: end tell
: tell application “QuarkXPress™ 4.11”
: activate
: tell page 1 of document 1
: set text of text box 1 to alias (filePath)
: end tell
: end tell end open
I am fairly new to AS as well but there is a command for vanilla AS (no OSAX) called . So, you might try:
set text to end of text box 1 of story 1 of alias (filePath)
I haven’t tested this and I’m not sure of the placement in your script but I’m sure someone with a bit more experience can point you in the correct direction.
Keep checking up on this sight for answers. I’ve found that of all the seminars, books, and other resources this is the best place out there to learn this stuff.
: Thanks Dave, This gets me back to the beginning. The problem isn’t getting
: the text, it’s placing the files sequentially. I was using–set story 1 to
: alias (filePath) and the script was simply replacing each text file with
: the next–same thing is happening with–set text of text box 1 to alias
: (filePath).
Actually this is what I meant… I’ve a droplet that takes text files, creates a QXP document, and makes a new page for each text file etc… etc… So i end up with a multiple page file, containing the contents of many text files…
Again, give me a shout and I can send you this…
Dave L.
: Actually this is what I meant… I’ve a droplet that takes text files,
: creates a QXP document, and makes a new page for each text file etc…
: etc… So i end up with a multiple page file, containing the contents of
: many text files…
: Again, give me a shout and I can send you this…
: Dave L.
That would be great–Thanks Use this address: rob@evansday.com