0 Replies Latest reply on Mar 25, 2009 11:55 PM by (kavya01sha)

    Indesign

      Hi All,

      I have designed a script. It invokes a form with textboxes and some buttons.
      1. If I click a button it has to add a template to the indesign. I have tried this. But when the form is open I am not able to do this.
      2. How to run a batch file by pressing a button?
      3. How to temporarily destroy a form?

      I have pasted the code below for your reference.

      var myDlg = new Window('dialog', 'XML InDesign Workflow',[100,100,800,600]);

      myDlg.tempSt = myDlg.add('statictext', [15,15,105,45], 'Template File:');
      myDlg.tempEt = myDlg.add('edittext', [115,15,550,45], ' ');
      myDlg.tempBtn = myDlg.add('button', [560,15,620,45],'Browse', {name:'bro'});

      myDlg.ruleSt = myDlg.add('statictext', [15,55,105,85], 'Rule File:');
      myDlg.ruleEt = myDlg.add('edittext', [115,55,550,85], ' ');
      myDlg.ruleBtn = myDlg.add('button', [560,55,620,85],'Browse', {name:'brow'});

      myDlg.xmlSt = myDlg.add('statictext', [15,95,105,125], 'XML File:');
      myDlg.xmlEt = myDlg.add('edittext', [115,95,550,125], ' ');
      myDlg.xmlBtn = myDlg.add('button', [560,95,620,125],'Browse', {name:'brows'});

      myDlg.msgEt = myDlg.add('edittext', [115,145,550,425], ' ', {multiline:true});

      myDlg.impBtn = myDlg.add('button', [115,445,205,475],'Import', {name:'imp'});
      myDlg.expBtn = myDlg.add('button', [280,445,375,475], 'Export', {name:'exp'});
      myDlg.cancelBtn = myDlg.add('button', [460,445,555,475], 'Cancel', {name:'cancel'});

      myDlg.tempBtn.onClick = function()
      {
      var selectedfile = File.openDialog("Choose template file", "*.indd", false);
      if (selectedfile != null) {
      myDlg.tempEt.text = selectedfile.fsName;
      }
      }

      myDlg.ruleBtn.onClick = function()
      {
      var selectedfile = File.openDialog("Choose rule file", "*.xml", false);
      if (selectedfile != null) {
      myDlg.ruleEt.text = selectedfile.fsName;
      }
      }

      myDlg.xmlBtn.onClick = function()
      {
      var selectedfile = File.openDialog("Choose XML file", "*.xml", false);
      if (selectedfile != null) {
      myDlg.xmlEt.text = selectedfile.fsName;
      }
      }

      myDlg.impBtn.onClick = function()
      {
      var myDocument = app.documents.add()
      }

      myDlg.cancelBtn.onClick = function()
      {
      myDlg.close()
      }

      myDlg.show();

      Thanks
      kavya