SaveAs button not working with dialogue


i have code i've written , links tools button. saveas function errors suggests not defined. running script folder-level script. have pasted script using below. can me or suggest me on do?

 

var subject

var adocumentfilename = this.documentfilename;

 

var dialog1 =

  {

  initialize: function (dialog) {

  var todaydate = dialog.store()["date"];

  todaydate = "date: " + util.printd("mmmm dd, yyyy", new date());

  dialog.load({ "date": todaydate });

  },

  commit:function (dialog) {

  var results = dialog.store();

  subject = results["fnam"];

  adocumentfilename = results["lnam"];

 

  },

  description:

  {

  name: "subject", 

  align_children: "align_left",

  width: 350,

  height: 200,

  elements:

  [

  {

  type: "cluster",

  name: "file entry",

  align_children: "align_left",

  elements:

  [

  {

  type: "view",

  align_children: "align_row",

  elements:

  [

  {

  type: "static_text",

  name: "case reference: "

  },

  {

  item_id: "fnam",

  type: "edit_text",

  alignment: "align_fill",

  width: 283,

  height: 20

  }

  ]

  },

  {

  type: "view",

  align_children: "align_row",

  elements:

  [

  {

  type: "static_text",

  name: "save file : "

  },

  {

  item_id: "lnam",

  type: "edit_text",

  alignment: "align_fill",

  width: 300,

  height: 20

  }

  ]

  },

  {

  type: "static_text",

  name: "date: ",

  char_width: 25,

  item_id: "date"

  },

  {

  alignment: "align_left",

  type: "ok_cancel",

  ok_name: "save",

  cancel_name: "cancel"

  },

  ]

  },

  ]

  }

  };

 

 

  var mytrustedtool = app.trustedfunction(function(name)

  {

  app.beginpriv();

  app.execdialog(name);

  app.endpriv();

  });

 

 

mysaveas = app.trustpropagatorfunction(function(doc,path) {

app.beginpriv();

doc.saveas(path);

app.endpriv();

});

 

 

mytrustedspecialtaskfunc = app.trustedfunction(function(doc,path) {

// privileged and/or non-privileged code above

app.beginpriv();

mysaveas(doc,path);

app.endpriv();

// privileged and/or non-privileged code below

});

 

 

if ("ok" == app.execdialog(dialog1)){

  // build file name

  var myfilename = "adocumentfilename -" + "subject" + ".pdf";

  // add folder name

  myfilename = "/c/documents/" + myfilename

  mytrustedspecialtaskfunc(this, myfilename);

};

 

app.addtoolbutton(

{

    cname: "dialoguebox3",

    cuser: "my menu",

    cparent: "tools",

    clabel: "dialogue3",

    cexec: "mytrustedtool(dialog1);",

    cenable: "event.rc = app.doc;"

});

 

thanks

the code calls function needs embedded in file itself. when application first opened, , folder-level script executed, there no files open, if opened double-clicking file.



More discussions in JavaScript


adobe

Comments

Popular posts from this blog

Reader DC

AdobeIDの作り方

Adobe InDesign CC 2017 has stopped working