Follow up - Saving to a Network Drive

Community Beginner ,
Oct 21, 2018

Copy link to clipboard

Copied

Thank you George Johnson for the help on my initial question!!! I made the suggested changes and worked perfectly on my machine. I then tried to move it over to the office and I'm sure I've done something screwy because it will no longer save.

This is the "trusted" (I'm hoping) js doc, which I have in the Acrobat Javascript file; also in the folder where the saved forms should be going AND in the folder containing the original doc.:

var mySaveAs = app.trustedFunction(

  function(oDoc, cPath, cFlName) {

  // Ensure path has trailing "/"

  cPath = cPath.replace(/([^/])$/, "$1/");

  try {

  app.beginPriv();

  oDoc.saveAs(cPath + cFlName);

  app.endPriv();

  } catch (e) {

  app.alert("Error During Save - " + e);

  }

  }

);

I believe one problem is the "cPath" part of that script...but I'm a novice and not sure what to replace it with.

Trying to save the completed form (applicant pressed a SEND button, which runs the JS associated with the button) to a MyCloud storage disk attached to our network. I set up a folder to receive the files, located here:   \\PHOENIX-MYCLOUD\Public\APPLICANTS

The button script is:

this.saveAs("Network/PHOENIX-MYCLOUD/Public/APPLICANTS/" + this.getField("lastname").valueAsString + " " + this.getField("firstname").valueAsString + " " + "application.pdf");

I have tried it with

//Network/PHOENIX-MYCLOUD/Public/APPLICANTS/ 

/Network/PHOENIX-MYCLOUD/Public/APPLICANTS/

//PHOENIX-MYCLOUD/Public/APPLICANTS/

I'm sure the problem is glaring at most of you...but me...LOST.

Thank you for your assistance - AGAIN!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

81

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

Follow up - Saving to a Network Drive

Community Beginner ,
Oct 21, 2018

Copy link to clipboard

Copied

Thank you George Johnson for the help on my initial question!!! I made the suggested changes and worked perfectly on my machine. I then tried to move it over to the office and I'm sure I've done something screwy because it will no longer save.

This is the "trusted" (I'm hoping) js doc, which I have in the Acrobat Javascript file; also in the folder where the saved forms should be going AND in the folder containing the original doc.:

var mySaveAs = app.trustedFunction(

  function(oDoc, cPath, cFlName) {

  // Ensure path has trailing "/"

  cPath = cPath.replace(/([^/])$/, "$1/");

  try {

  app.beginPriv();

  oDoc.saveAs(cPath + cFlName);

  app.endPriv();

  } catch (e) {

  app.alert("Error During Save - " + e);

  }

  }

);

I believe one problem is the "cPath" part of that script...but I'm a novice and not sure what to replace it with.

Trying to save the completed form (applicant pressed a SEND button, which runs the JS associated with the button) to a MyCloud storage disk attached to our network. I set up a folder to receive the files, located here:   \\PHOENIX-MYCLOUD\Public\APPLICANTS

The button script is:

this.saveAs("Network/PHOENIX-MYCLOUD/Public/APPLICANTS/" + this.getField("lastname").valueAsString + " " + this.getField("firstname").valueAsString + " " + "application.pdf");

I have tried it with

//Network/PHOENIX-MYCLOUD/Public/APPLICANTS/ 

/Network/PHOENIX-MYCLOUD/Public/APPLICANTS/

//PHOENIX-MYCLOUD/Public/APPLICANTS/

I'm sure the problem is glaring at most of you...but me...LOST.

Thank you for your assistance - AGAIN!

TOPICS
Acrobat SDK and JavaScript, Windows

Views

82

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
Oct 21, 2018 0
BarlaeDC LATEST
Adobe Community Professional ,
Oct 22, 2018

Copy link to clipboard

Copied

Hi,

After a quick look, the code does not look like it matches up between the trusted function and the button script.

Your trusted function is called "mySaveAs", whereas the button code calls "this.saveAs" which is the Adobe provided function and not your trusted function.

I think your button code should be something more like:

// Split up to make it easier to follow

var oDoc = app.activeDocs[0];

var cPath = "Network/PHOENIX-MYCLOUD/Public/APPLICANTS/";

var cFlName = this.getField("lastname").valueAsString + " " + this.getField("firstname").valueAsString + " " + "application.pdf"

mySaveAs ( oDoc, cPath, cFlName);

The other to check is to use a local path to begin with to make sure that your code is being called and works, then  move to the network drive.

Regards

Malcolm

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...
Oct 22, 2018 0