LoginSignup
2
2

More than 5 years have passed since last update.

【AppleScript+Illustrator】日本語パスのAIファイルを開く

Last updated at Posted at 2014-08-25

AppleScriptでAdobe系のアプリケーションをコントロールする際、
何気に問題になる日本語ファイルパスの対応法メモ。


on aiFileOpen(f)
    (*最初にPosix Pathに変換*)
    set f to POSIX path of f

    (*シングルコーテーションをエスケープ*)
    set AppleScript's text item delimiters to {"'"}
    set f to text items of f
    set AppleScript's text item delimiters to {"\\'"}
    set f to f as Unicode text
    set AppleScript's text item delimiters to {""}

    (*JavaScriptでencodeURIエスケープして開く*)
    tell application id "com.adobe.illustrator"
        do javascript "app.open(new File(encodeURI('" & f & "')));"
    end tell
end aiFileOpen

aiFileOpen(choose file of type {"ai"})
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2