Help with executing a script from a script on mac OS

New Here ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

Let me explain my situation. At my workplace, my coworker and I use Illustrator for printing purposes and I have written some scripts (.jsx) to make things easier. I use a windows computer and my coworker uses a mac. We have a network we use for sharing files between computers, so I thought creating a script to run the main script from the network would save lots of time in the event that I needed to make any changes going forward. I was successful when I made such a file for windows (shown below), but I've been having a lot of difficulty with making one for mac. I have tried different formats for the mac file path, but nothing I've tried has worked so far.

var scriptFile = new File("\\\\#.#.#.#\\Network Shared\\Illustrator Scripts\\Completed\\SetOverprint.jsx");
scriptFile.execute();

 

Any pointers to what I'm doing wrong are immensely appreciated.

TOPICS
Scripting

Views

118

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

New Here , Feb 04, 2021 Feb 04, 2021
I took a look at the article and changed my double backslashes for forward slashes. I ended up getting to a point where the path with the server address would work on windows but not mac, and the same path without the address would work on mac but not windows. From there, I just made it add the address to the path if the user was running windows and that seems to do the job.var osVersion = $.os.substring(0,7); if (osVersion == "Windows") { pathOfFile = "//#.#.#.#" + pathOfFile; } 

Likes

translate

Translate

Translate
Adobe Community Professional ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

-

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Feb 04, 2021 Feb 04, 2021

Copy link to clipboard

Copied

macOS natively uses POSIX file paths. Windows-style file paths will not work.

 

Read the JavaScript Tools Guide:

 

javascript-tools-guide.readthedocs.io/file-system-access/index.html

 

That explains how to construct paths that will work cross-platform. (The syntax is similar to that used in URLs.)

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Feb 04, 2021 Feb 04, 2021

Copy link to clipboard

Copied

I took a look at the article and changed my double backslashes for forward slashes. I ended up getting to a point where the path with the server address would work on windows but not mac, and the same path without the address would work on mac but not windows. From there, I just made it add the address to the path if the user was running windows and that seems to do the job.

var osVersion = $.os.substring(0,7);

if (osVersion == "Windows")
{
	pathOfFile = "//#.#.#.#" + pathOfFile;
}

 

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines