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

"Save As" button

New Here ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

Instead of the regular "save as" button, which doesn't appear to allow for a preset file destination or a name based on the contents of several text fields and the date. Can a script be written to concatinte the file name and save this as a custom validation script to either a radio button or to a dropdown giving the options "Print", "Save", "Reset"

 

Text field 1: First name

Text field 2: Surname

 

File name:  <Text field 1> + <Text field 2> + "_1_" + <Date (yymmdd)>

File location: C:\Staff - Documents\Completed Forms\

 

The drop down option is preferred but how could Print and Reset be similarly implmented. For the "Reset", the form has 23 Text Fields and 20 Dropdowns ("Yes", "No", "Not applicable", " "). Dropdown default is " "".

TOPICS
PDF forms

Views

635

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
Community Expert ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

Read This:

https://www.pdfscripting.com/public/How-to-Save-a-PDF-2.cfm

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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 ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

Hello Thom,

 

I can get the script to work partially. 

 

1) I saved the form in the <Documentation> folder and assigned the file in the privaledged location in the enhanced security preference option.

2) Created 2 versions of the script. First one to save to temp, second to save to Completed Forms. Both versions were saved in 'on focus' under the action tab of a test dropdown. 

 

The Save to Temp works, the Save to completed Forms generates this error.

 

NotAllowedError: Security settings prevent access to this property or method.
Doc.saveAs:1:AcroForm:Dropdown21:Annot1:OnFocus:Action1

 

saveAs("C:/Users/<NAME>/<DRIVE>/Documents/Workflow/Completed Forms/temp.pdf");

 

//C:\Users\<NAME>\<DRIVE>\Documents\Workflow\Documentation

//C:\Users\<NAME>\<DRIVE>\Documents\Workflow\Completed Forms
//C:\Temp\

 

The only difference is that Users is part of the Windows user account folder structure with the <NAME> dependent on the user signed into the computer, wereas temp is a highlevel harddrive folder. Have I missed something obvious?

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
Community Expert ,
Jan 26, 2021 Jan 26, 2021

Copy link to clipboard

Copied

LATEST

First,  DO NOT USE ONFOCUS for this action. Use the MouseUp event.

 

Next, I hope you are not literally using "<NAME>" in the path. This will of course not work. 

 

You can debug/resolve this issue using the console window, i.e., the console window allows you to test code directly, so you can change it and see what happens in real time. 

You find a video tutorial here:

https://www.pdfscripting.com/public/Free_Videos.cfm#JSIntro

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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
Community Expert ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

Yes, but you would need to install a special script file on the local computer of each user who will use it.

Also, it can't create the folder for you. It has to exist in advance.

Is all of that possible in your case?

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 ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

Yes, in theory. I wouldn't know how to establish the script and get users to deploy it. Unless an install could be performed by the "worksheet" itself following taccit agreement by the user i.e. the script install is launched by a button press. The folder is easy (ish) the users all sit under "Layer1" the issue is the "username" varies with each user and one option is to get this name entered by the user in a separate text field (unless it can be extracted automatically through reading the desktop folder location and masking) - non of which I know how to do. The folder structure in each user directory i.e. Layer2\Layer3\Layer4 is fixed. 

 

DISK:\Layer1\Username\Layer2\Layer3\Layer4

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
Community Expert ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

No, the file itself can't deploy the script. It will have to be manually copied to a specific folder on the user's machine.

 

If you're interested I could develop this script for you and explain how to install it, for a fee.

You can contact me privately via [try6767 at gmail.com] to discuss it further.

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
Community Expert ,
Jan 25, 2021 Jan 25, 2021

Copy link to clipboard

Copied

The script your are looking for is free, and at the link I posted.

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

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