2 Replies Latest reply on Jul 24, 2017 5:47 PM by RiadMed

    "File/Folder Expected" Error

    agh21

      I cannot seem to debug an error I am getting from an Applescript that is adapted from the business card template that ships with Illustrator. Specifically, at the line "update dataset i of document currentDoc" I am getting an error "File/Folder expected." I am happy to post the entire script but, before doing so, does anyone see anything obviously wrong with the below which may be causing this error?

       

      Thank you in advance for any assistance:

       

       

        tell application "Adobe Illustrator"

        activate

        set mysetcount to myindex - 1

        repeat with i from 1 to mysetcount

        import variables document currentDoc from alias XMLfilePath

        set pathText to item i of filePaths

        update dataset i of document currentDoc

        set mynewfile to exportFolder & "CaseNo" & i & "-productsource.pdf" as string

        set myfile to file path of document currentDoc

        save document currentDoc in file mynewfile as pdf

        close document 1 saving no

        open myfile

        end repeat

        end tell

        end if

      end batchExport

        • 1. Re: "File/Folder Expected" Error
          Silly-V Adobe Community Professional

          These always get me, for me I always have to think and re-think how the files and folders an POSIX files and POSIX folders and paths of each all relate to each other in AppleScript. Then, after much trial and error I have some snippet which I copy/paste across all my AppleScripts. In my case it's always been a matter of converting regular files/folders to POSIX ones and vice-versa.

          • 2. Re: "File/Folder Expected" Error
            RiadMed Level 1

            Hi

             

            Just add a delay after importing variables to compensate for the time the variables gets loaded to illustrator., add this:

             

            delay 1

             

            hope it helps

            1 person found this helpful