Loop problem

I have a script that I’m adapting from one in one of Ethan WIldes books, it has a loop that seems to work on groups of 2 or more files, but not when it’s just one file. I really need this to work on any number of files, including just one!

All help very much appreciated.

Here is the code, I’ve truncated it - the relevant parts are shown however.

[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

try this:
(Tested and working)

on adding folder items to this_folder after receiving these_files
     set destinationFolder to "OSX:Library:WebServer:Documents:fileops:out:"
     set destinationPath to destinationFolder as string
     repeat with ThisFile in these_files
          tell application "Finder" to set fileName to name of ThisFile
          if fileName is not ".DS_Store" then
               set newFilePath to destinationPath & fileName
               tell application "Illustrator CS"
                    open aFile
                    save current document in file newFilePath as eps ¬
                         with options {class:EPS save options ¬
                         , compatibility:Illustrator 11 ¬
                         , preview:color Macintosh ¬
                         , embed linked files:false ¬
                         , include document thumbnails:false ¬
                         , embed all fonts:true ¬
                         , CMYK PostScript:true ¬
                         , PostScript:level 2}
                    close current document saving no
               end tell
          end if
     end repeat
end adding folder items to


Hi SitCom

that didn’t work :frowning:

Illustrator just sits there and ignores it.