• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

498

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;
}

 

Votes

Translate

Translate
Adobe
LEGEND ,
Feb 03, 2021 Feb 03, 2021

Copy link to clipboard

Copied

-

Votes

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
Engaged ,
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.)

Votes

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

LATEST

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;
}

 

Votes

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