paste file name list into Quark?

Actually I would prefer to do this is in SimpleText but apparently SimpleText isn’t scriptable? Anyway, I just want to put a list of all the names of all the files in a folder (including subfolders) into a text box in Quark. If it could be a vertical list instead of running on that would be even better.
This is what I have so far:
tell application “Finder”
repeat
set masterFolder to choose folder
set Tester to name of masterFolder as text
if Tester contains “photo” then exit repeat
set thisDialog to display dialog “Folder name must contain ‘Photo’!”
end repeat end tell tell application “Finder”
with timeout of 500 seconds
repeat with j from 1 to the number of folders in masterFolder
set x to folder j of masterFolder
repeat with i from 1 to the number of files in x
set FileName to name of file i of x
–this is where I need help; getting the names into Quark
end repeat
end repeat
end timeout
display dialog " Done." buttons (“OK”) default button “OK” end tell
So should I activate Quark before the repeat loop? Or should I start with an open Quark document that has the text box already set up in it (a template maybe?). And how do I transfer the text into Quark?
If I add a “&” at the end of each filename will Quark read it as an actual return?
Thanks.

Sorry to be so dense but I cannot get the list of file nmaes to copy to the clipboard no matter how I configure it. I either get a message “Could not set clipboard to or “this commands cannot run in the background”
Below is a simplified version of my script so far. It makes a nice list off all thwe files, but I need to get that list into Quark either via the clipboard or some other way.
Thanks.
tell application “Finder”
repeat
set masterFolder to choose folder
set Tester to name of masterFolder as text
if Tester contains “photo” then exit repeat
set thisDialog to display dialog “Folder name must contain ‘Photo’!”
end repeat end tell tell application “Finder”
with timeout of 500 seconds
set y to name of every file of every folder of masterFolder as list
– need to get the list onto the clipboard or get it into Quark
end timeout
display dialog " Done.” buttons (“OK”) default button “OK” end tell

Never mind. I have it figured out to an extent. Now all i need to do is insert returns after each item. if anyone has any ideas on this I’d be grateful. Otherwise I will continue to blunder on. New version:
tell application “Finder”
repeat
set masterFolder to choose folder
set Tester to name of masterFolder as text
if Tester contains “photo” then exit repeat
set thisDialog to display dialog “Folder name must contain ‘Photo’!”
end repeat end tell tell application “Finder”
with timeout of 500 seconds
set y to name of every file of every folder of masterFolder as text
tell application “QuarkXPress™ 4.11”
set the first story of front document to y
end tell
end timeout
display dialog " Done." buttons (“OK”) default button “OK” end tell

: Never mind. I have it figured out to an extent. Now all i need to do is
: insert returns after each item. if anyone has any ideas on this I’d be
: grateful.

  • If you’ll look at the short example code I posted for you, it does exactly what you want. You need use text item dilimiters to capture the item name list with returns in between.

: Sorry to be so dense but I cannot get the list of file nmaes to copy to the
: clipboard no matter how I configure it. I either get a message "Could
: not set clipboard to or “this commands cannot run in the
: background”
the “set clipboard to” command is part of the “Standard Additions” osax, but that ought to be present on most machines, no?

Got it. Thanks.

: Sorry to be so dense but I cannot get the list of file nmaes to copy to the
: clipboard no matter how I configure it. I either get a message "Could
: not set clipboard to or “this commands cannot run in the
: background”

Try this:

tell application "Finder"
    with timeout of 500 seconds
        --set y to name of every file of every folder of masterFolder as list
        set y to name of masterFolder
        -- need to get the list onto the clipboard or get it into Quark 
        activate
        set the clipboard to (y as text)
    end timeout
    display dialog " Done." buttons ("OK") default button "OK"
end tell

(I can’t fully test it, since my version of AS seems to be having problems with aliases.)

–tet