title: How To Open Files in Illustrator 2020 via AppleScript
body: <p>OSX 10.13.6, AI 2020, Applescript Editor Version 2.10 (194), AppleScript 2.7</p>
  
  <p>(Don't think this should matter, but am not prepared to upgrade the OS, as NVidia still hasn't released drivers for the TitanXP GPU the system uses).</p>
  
  <p>Sticking to AppleScript in this discussion.  No "Just Use JavaScript" suggestions please, unless you can confirm or deny that the problem also occurs in JavaScript.</p>
  
  <p>Am wondering if Adobe has made a change to their Illustrator API, as, since upgrading to the new 2020 version, Applescript files that used to work with earlier versions of Illustrator are now having difficulty opening files when referred to by an alias, or a variable in posix-style format.</p>
  
  <p>InDesign does not seem to have been affected, as every time a major version upgrade occurs I run a script on some several hundred .INDD files to prevent the "save-as" dialog next time they are used, which can mess up scripting.  That script still works.  Haven't tried Photoshop yet, but most of the automation I use there is in the form of their internal "Actions".</p>
  
  <p>After a little research, am thinking they may have tinkered with HFS support, resulting in unanticipated consequences.</p>
  
  <p>Illustrator 2020 can open a file referenced by a hard-coded string in posix-style format, but it cannot open that same file from a variable, either an HFS-style alias, or quoted posix-style string, i.e,</p>
  
  <pre><code>  set theHFSPath to "Mac HD:Users:Mac User:Documents:Illustrator:myFile.ai"
    set thePosixPath to quoted form of theHFSPath
    # i.e., '/Volumes/Mac HD/Users/Mac User/Documents/Illustrator/myFile.ai'
  
    Tell Application "Adobe Ilustrator"
      # Opens OK
      open POSIX file "/Volumes/Mac HD/Users/Mac User/Documents/Illustrator/myFile.ai" without dialogs
  
      # Crashes with "Adobe Illustrator got an error: The specified file could not be opened because it could not be found"
      open theHFSPath as alias without dialogs
      # open (theHFSPath as alias) also crashes
  
      # Crashes with "Adobe Illustrator got an error: File/Folder expected"
      open POSIX file thePosixPath without dialogs
      # open POSIX file (quoted form of thePosixPath)
      #    without quoting HFSPath above also crashes
    End Tell
  </code></pre>
  
  <p>Am suspecting Adobe maybe dropped a low-level routine that dealt with HFS, and with this routine failing, the open command cannot "see" the file to open it.</p>
  
  <p>Not much on the 'tubes yet, but I have run across:</p>
  
  <p><a href="http://forum.latenightsw.com/t/apple-script-for-illustrator-2020-javascript-code-was-missing/2167" rel="nofollow noreferrer">http://forum.latenightsw.com/t/apple-script-for-illustrator-2020-javascript-code-was-missing/2167</a></p>
  
  <p>from a little less than a week ago, which seems to be describing the same issue.</p>
  
  <p>Anyone else run across this, or know how to get around it?</p>