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

Folder level SaveAs problem

jck_drmjn
Level 5
Level 5

The following script is folder level script:

var mySaveAs = app.trustedFunction(function(doc)

{        

             app.beginPriv();

        var myPath = /C/Users/Dream_peak/Desktop/test.xml;

        doc.saveAs(myPath);

             app.endPriv();

});

under button:

event.target.mySaveAs(event.target);

Nothing happen. Where am I making mistake? Need more script to deploy this function?

Thanks

0 Replies
Niall_O_Donovan
Level 10
Level 10

Hi,

Try something like this:

mySaveAs = app.trustPropagatorFunction(function(myForm, path)

{

             app.beginPriv();

                  var myForm = event.target;

                  return rtn = myForm.saveAs(path);

             app.endPriv();

});

Hope that helps,

Niall

jck_drmjn
Level 5
Level 5

Thanks for your help.

I was trying like this:

mySaveAs = app.trustPropagatorFunction(function(myForm, path)

{

             app.beginPriv();

                  var myForm = event.target;

                     path ="/C/Users/Dream_peak/Desktop/test.xml";

                  return rtn = myForm.saveAs(path);

             app.endPriv();

});

Nothing happen.

Cnsole error:

event.target.mySaveAs(event.target);

TypeError: event.target is undefined

1:Console:Exec

undefined

In addition I wanted to save it as xml. Need to export function?

Thanks again

Niall_O_Donovan
Level 10
Level 10

Hi,

Have a look at a thread here: http://forums.adobe.com/message/2266799#2266799. It is kinda long, but has examples attached.

You can just script an Export Data, but that will prompt the user to save the XML file to a location.

Hope that helps,

Niall

jck_drmjn
Level 5
Level 5

Nice! I wanted to save as xml in specific folder. I changed .pdf to .xml but nothing happen.

Is it possible to do so?

Niall_O_Donovan
Level 10
Level 10

Hi,

Possibly not! Creating the XML file is a specific export process, whereas the trusted function is set up as a save-as.

Maybe someone else will have some better ideas.

Niall

jck_drmjn
Level 5
Level 5

Hi Nial,

Thanks a lot. your help makes easy go forward.

I have got a answer form radzmar on http://thelivecycle.blogspot.com/2009/11/save-form-to-specific-directories-and.html#uds-search-resul...

For others I have posted the soution.

function myDateString() {

return util.printd("mmddyy_HHMMss", new Date());

}

// SaveAs Function

var mySaveDoc = app.trustedFunction(function(doc) {

app.beginPriv();

var myPath = this.path.replace(this.documentFileName, "");

var myPath = myPath + "TEST_" + myDateString() + ".xml";

this.exportXFAData({

cPath: myPath,

bXDP: false,

aPackets: ["*"]

})

app.endPriv();

});