Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

add code to generate filename to existing "Save As" button

Avatar

Level 2

Hi. I created a pdf version of a standard form we use here at the office. One of the users is very, very much a computer novice and simply saving and renaming is a challenge. So, I put a shortcut to the form in the folder where the created forms need to be saved (so that is the default save location) and created a save as button on the form, but I'd also like to automate the save as file name.

I have this code under the "mouseup" event:

 

app.execMenuItem("SaveAs")

var fn =   getField("date").rawValue  + "-" + getField("company").rawValue;

This is my result...

_3c5o2408p3b4a69j3o.pdf

Any ideas what I'm doing wrong or missing OR what might be a better way to skin this cat?

Thanks!

0 Replies

Avatar

Level 5

I use always:

var FilePath = event.target.path;

this.rawValue = FilePath;

Important:

If you use this in the preview of the LCD you get your result.

The right result (the path) you get if you use this with the Adobe Reader.

This is the same with this script then with the LCD preview you got the temp file name:

this.rawValue = event.target.documentFileName;

Hope it will helps you,

Mandy

Avatar

Level 2

Did you get this figured out?

I have a related issue where I want to save the form file with a save button to a specific path and also name it according to the value of several variables in the filled out form.

i.e "Code_serial_workorder_date.pdf"

If I could email that file with the same button that would be even better.

I have been looking around the forums but I have yet to see something like that.

DT