javascriptadobe-illustrator

$.fileName will not work in script in OS X and Adobe Illustrator


I'm using a .jsx-script in Adobe Illustrator, which stores its preferences in an JSON file generated in the basic script folder within the Adobe program folder.

But it does not work in my case, the file will not be created. The reason is, that the script does actually not get a path where to build it, so no file is being created.

I gave Illustrator full hard drive privileges already, but the script will not show the script path. On a different machine it's the same behavior, but I know the script will work for most other users. Even running the script from desktop does not work.

app.path

will give the path to Adobe Illustrator, the script is placed within that folder. I can read and write within the script subfolder of Adobe Illustrator.

var scriptPath = (new File($.fileName)).path 

will tell "", with alert just an empty field

var scriptName = (new File($.fileName))

will throw /3 with alert (scriptName). It will always be /3, that's kind of wired.

It's the same, when I run the script from Desktop. Any idea, why the script will not get it's path? No one in the community had an idea so far (other than permissions, but as mentioned above, they do not account for this issue as app.path works) ...


Solution

  • $.fileName will not work if the script will be started from different Scripts Panel plugins, but will work when started from Illustrator scripting menu.

    There is a bug in these Scripts Panels, which breaks all lines of code with $.fileName. Refer to the discussion at Adobe Community Adobe Community