These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Creating a filename for a form after executing 'save as' script

PetafromOz
Registered: Jun 8 2009
Posts: 230

I have a feeling this has been asked before, but the closest I've found to something similar was this:
http://www.acrobatusers.com/forums/aucbb/viewtopic.php?id=22934

But I didn't understand Radzmar's response. How do you create a script at folder level?

I'll clarify what I'm after.

When the user has completed the form, they click a 'save as' button to enable them to save their file.
I've got that working fine with the following:

form1.ExtraTraining.SaveFormAsBtn::mouseUp - (JavaScript, client)
xfa.host.messageBox("Please save this form with your own file name","Reminder",1);
app.execMenuItem("SaveAs");

but then under that I've got...
// SaveAs and close this document
mySaveDoc("TACPg1.TACSF.LastName.pdf");

...this is to try to pick up the user's name from the 'LastName' field and place it into the Filename: field when the 'Save As' dialog is displayed. Only it doesn't work.

What I'm trying to achieve is that when the user clicks the 'save as' button, it not only prompts them to do so, but loads something other than the original template name into the filename field - so that the template can't be overwritten. But also so that when they submit the form, it will be clear by the filename who it's from.

Any thoughts?

from way... underground at Parkes - central West NSW - Australia

PetafromOz
Registered: Jun 8 2009
Posts: 230
I've had another think about this. The form's filename is stored under the 'file' tab in the Form Properties. There must be a way to address this via a script? And if so, then it seems logical to me that the 'save as' script could include changing that filename?

from way... underground at Parkes - central West NSW - Australia

radzmar
Expert
Registered: Nov 3 2008
Posts: 1202
Hi,

a folder level script is a .js-file you place into the javascrips folder of your Acrobat/Reader on your system drive.
You can create such scripts easily with an text editor.
If you then rename the file extension from .txt to .js you have a .js-file that can be read out by Acrobat/Reader.

I described how to save a file with a folder level script in my blog.
There you can also find an xfa form and a folder level script file for testing.
[url]http://thelivecycle.blogspot.com/2009/11/save-form-to-specific-directories-and.php[/url]

Remember:
The value in the brackets for the method saveAs() can only be changed from a privileged source, which is not the form but a folder level script.

radzmar
LoveCycle Blog
Documents you need:
LiveCycle Designer ES2 Docs

PetafromOz
Registered: Jun 8 2009
Posts: 230
Thanks Radzmar, I'll have a look & work on it.

from way... underground at Parkes - central West NSW - Australia