Expand my Community achievements bar.

Folder level SaveAs problem

Avatar

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

6 Replies

Avatar

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

Avatar

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

Avatar

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

Avatar

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?

Avatar

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

Avatar

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();

});