Referencing mapped drive in script

New Here ,
Nov 30, 2020

Copy link to clipboard

Copied

I have an inDesign server .jsx that works well for altering an inDesign file and exporting as a PDF, however I need to change my export location off of the C drive so that I can mount it to an external Linux server. I have tried using the full UNC path of a network share as well as a mapped drive, but I am unable to reference a file location outside of the C drive and cannot find documentation on referencing an external drive. 

 

Does anyone know the syntax for a file located outside of the C drive? The following line of code works for setting the export location on the C drive, but altering the path to another drive or IP address does not seem to work. 

var myFile = new File("/c/path/to/file/sampleFile.pdf");
 
I have also tried copying the script to the other drive and using that path in the SOAP call, but I receive a 500 error when the following line in the call is changed from C:\ to J:\
 
<IDSP:scriptFile>c:\path\to\script\sampleScript.jsx</IDSP:scriptFile>
 
Any suggestions?
TOPICS
Scripting, Server developers

Views

58

Likes

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

Referencing mapped drive in script

New Here ,
Nov 30, 2020

Copy link to clipboard

Copied

I have an inDesign server .jsx that works well for altering an inDesign file and exporting as a PDF, however I need to change my export location off of the C drive so that I can mount it to an external Linux server. I have tried using the full UNC path of a network share as well as a mapped drive, but I am unable to reference a file location outside of the C drive and cannot find documentation on referencing an external drive. 

 

Does anyone know the syntax for a file located outside of the C drive? The following line of code works for setting the export location on the C drive, but altering the path to another drive or IP address does not seem to work. 

var myFile = new File("/c/path/to/file/sampleFile.pdf");
 
I have also tried copying the script to the other drive and using that path in the SOAP call, but I receive a 500 error when the following line in the call is changed from C:\ to J:\
 
<IDSP:scriptFile>c:\path\to\script\sampleScript.jsx</IDSP:scriptFile>
 
Any suggestions?
TOPICS
Scripting, Server developers

Views

59

Likes

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
Nov 30, 2020 0
Contributor ,
Nov 30, 2020

Copy link to clipboard

Copied

I've always used this form for UNC:

 

"//Server/drive/folder/file.ext"

 

 

Likes

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
Reply
Loading...
Nov 30, 2020 0
New Here ,
Dec 01, 2020

Copy link to clipboard

Copied

Thank you for the response, unfortunately that syntax isn't working in this instance. Using forward slashes adds the C drive automatically and completely messes up the path. When using backlashes the folder is not recognized, even though the path is copied directly.

 
 

var myOutFile = new File("\\**.*.*.**\***\process\que\finished\businessCard2.jpg");

Error: "Cannot find the folder "\\**.*.*.**\***\process\que\finished\businessCard2.jpg"

 

Is there any reason the shared network would not be accessible from the JSX script? I have tried altering permissions and had no luck. 

Likes

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
Reply
Loading...
Dec 01, 2020 0
Enthusiast ,
Dec 01, 2020

Copy link to clipboard

Copied

Hello,

 

For what it's worth, this works for me running a .jsx script from InDesign on a Mac setting a variable to open a template on a shared network.

 

var myTemplate = File('/Volumes/ServerShareName/FolderName/MyTemplate.indt');

 

Regards,

Mike

 

Likes

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
Reply
Loading...
Dec 01, 2020 0
Most Valuable Participant ,
Dec 01, 2020

Copy link to clipboard

Copied

One thing that it's easy to overlook is that a server process is often run in a different environment or different user. This means it won't have any of the networked drive letter you see when you look in an interactive seesion. The user used may have no rights to mount the remote drives you want to use. This may need careful liason with the server and network administrators.

Another point to consider is that some consider it unwise to make a server process write a network drive, because you introduce multiple points of failure. Fine if ALL work depends on this network drive, but if you have multiple outputs, you may be setting up something to fail if any part of the system fails. Generally it's better to write local, then use an asychronous system to copy to the network.

Likes

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
Reply
Loading...
Dec 01, 2020 0