2 Replies Latest reply on Nov 20, 2015 11:45 AM by RESlyder

    Dialog box with multiline input?

    RESlyder

      I am working on automating one of our more tedious graphic types, a typed up deposition, and ran into a snag. I have a dialog box pop up that the user populates. They put in the Deponent's name, position, and then I have a large area for them to paste in the text they would like to insert into the graphic. Unfortunately it only pastes the first line of the text. Is there a way to input more than one line into a dialog box? Initial searches lead me to believe that prompt inputs can only be one line, but I have to imagine there is a way. Any ideas? Not having any issues putting the text in the box, the issue is pasting into the dialog.

       

      Thanks!

       

      Here is a trimmed down version of the portion of the dialog I am having issues with:

      The content GRP is the area I was planning to use for the multi-line text blocks.

      // Export dialog
          this.dlg = new Window('dialog', 'Create new depo layer'); 
      
          // PANEL to hold options
          var msgPnl = this.dlg.add('panel', undefined, 'Create new deposition layer'); 
      
          // content GRP
          var contentGrp = msgPnl.add('group', undefined, '')
          contentGrp.oreintation = 'row';
          contentGrp.alignment = [ScriptUI.Alignment.LEFT, ScriptUI.Alignment.TOP]
          
          var contentSt = contentGrp.add('statictext', undefined, 'Content:'); 
          contentSt.size = [100,20]
      
          var contentEt = contentGrp.add('edittext', undefined, ''); 
          contentEt.size = [ 300,500 ];
          
          var btnPnl = this.dlg.add('group', undefined, ''); 
          btnPnl.orientation = 'row'
      
          btnPnl.cancelBtn = btnPnl.add('button', undefined, 'Cancel', {name:'cancel'});
          btnPnl.cancelBtn.onClick = function() {this.dlg.close() };
      
          // OK button
          btnPnl.okBtn = btnPnl.add('button', undefined, 'Create Single Depo Layer', {name:'ok'});
          btnPnl.okBtn.onClick = function() { 
                  //add the textPull content in
                  var textPullBox = docRef.textFrames.getByName("textPull");
                  if(contentEt.text != ''){
                     textPullBox.contents = contentEt.text;
                  }
                  var paraStyle;
                  if (contentEt.text.match(/Q./) || contentEt.text.match(/A./)){
                      paraStyle = docRef.paragraphStyles.getByName("DepoPull");
                      }
                  else{
                      paraStyle = docRef.paragraphStyles.getByName("TextPull");
                      }
                  //apply the paragraph style
                  for(tp=0; tp<textPullBox.paragraphs.length-1; tp++) {
                      paraStyle.applyTo(textPullBox.paragraphs[tp], true);
                  }
                  
                  //close dialog box
                  this.dlg.close();
          };    
      
          this.dlg.show();