You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用Atom运行Adobe Illustrator CC 2017脚本报错求助

Fixing "Expected string but found end of script" Error with Atom's process-palette for Adobe Illustrator Scripts

That error (-2741) almost always boils down to quoting/escaping issues when passing your JSX script through osascript from Atom's process-palette. Unlike ESTK or running the script directly in Illustrator, the command line layer adds extra syntax rules that can break your script if not handled properly. Here's how to fix it:

Step 1: Avoid Inlining Your Script in the osascript Command

The biggest culprit is trying to pass your entire JSX script as a string in the -e argument. Even small scripts can have quotes, newlines, or special characters that osascript misinterprets. Instead, save your script as a .jsx file and tell Illustrator to run it directly:

Use this command format in process-palette:

osascript -e 'tell application "Adobe Illustrator" to do script file "'"$PWD/your-script.jsx"'"'
  • $PWD uses your current Atom working directory to find the script (make sure your script is in that folder).
  • The nested quoting ('"' and '"') ensures the path is correctly passed as a string to the AppleScript command.

Step 2: Escape Special Characters If You Must Inline

If you really need to run a short snippet inline, double-check all quotes and escape them properly:

  • If your JSX uses double quotes ("), wrap the osascript -e content in single quotes ('), and escape any single quotes in your script with \'.
  • Example of an inline script with escaped quotes:
osascript -e 'tell application "Adobe Illustrator" to do script "alert(\'Hello from Atom!\');"'

Step 3: Verify Process-Palette Configuration

Make sure your process-palette command is formatted correctly:

  • Don't split the osascript command across multiple lines unless you escape each line break with a backslash (\).
  • Ensure there are no extra spaces or unclosed quotes in the command string.

Step 4: Test with a Minimal Script

To rule out issues in your actual script, create a simple test .jsx file:

// test.jsx
alert("Test successful!");

Run this with the file-based command from Step 1. If it works, the problem is in your original script's handling of characters that clash with command-line quoting.

Why does this work in ESTK/Illustrator but not Atom? Because ESTK directly communicates with Illustrator's scripting engine without going through the command line, so it doesn't have to deal with osascript's string parsing rules.

内容的提问来源于stack exchange,提问作者Bob Haslett

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 08:21:02