0 Replies Latest reply on Jul 17, 2014 4:20 AM by Johnwhite

    paragraph

    Johnwhite Level 1

      Hi,

       

      I made a script for add a continued at end of paragraph but unfunction, call you please help to fix it?

       

      var myDialog = app.dialogs.add({name:"add continueds",canCancel:true});
      with(myDialog){
          with(dialogColumns.add()){
              with(dialogRows.add()){
                 var mySelection = dropdowns.add({stringList:["Continued", "continued", "Cont'd","cont'd"], selectedIndex:0});
             }
         }
      }


      if (myDialog.show() == true)
         
      main();
      function main(){
      var myObject;
      var myCheckSelection = false;
      if(app.documents.length > 0){
        if(app.selection.length > 0){
         switch(app.selection[0].constructor.name){
          case "InsertionPoint":
          case "Character":
          case "Word":
          case "TextStyleRange":
          case "Line":
          case "Paragraph":
          case "TextColumn":
          case "Text":
          case "Cell":
          case "Column":
          case "Row":
          case "Table":
           myObject = app.selection[0];
           if(myObject != "None")
         }
        }
      }
      else{
        alert("No documents are open. Please open a document and try again.");
      }
      }
      function addContinueds(){
          if (mySelection.selectedIndex == 0){
         app.findGrepPreferences.findWhat = "(.)\\r";
         app.changeGrepPreferences.changeTo = "$1 (Continued)\\r";
         app.selection[0].changeGrep();
         app.findGrepPreferences = app.changeGrepPreferences = null;
          }
          if (mySelection.selectedIndex == 1){
         app.findGrepPreferences.findWhat = "(.)\\r";
         app.changeGrepPreferences.changeTo = "$1 (continued)\\r";
         app.selection[0].changeGrep();
         app.findGrepPreferences = app.changeGrepPreferences = null;
          }
         if (mySelection.selectedIndex == 2){
         app.findGrepPreferences.findWhat = "(.)\\r";
         app.changeGrepPreferences.changeTo = "$1 (Cont'd)\\r";
         app.selection[0].changeGrep();
         app.findGrepPreferences = app.changeGrepPreferences = null;
          }
        if (mySelection.selectedIndex == 3){
         app.findGrepPreferences.findWhat = "(.)\\r";
         app.changeGrepPreferences.changeTo = "$1 (cont'd)\\r";
         app.selection[0].changeGrep();
         app.findGrepPreferences = app.changeGrepPreferences = null;
          }
      }

       

      John