Quantcast
Channel: Adobe Community : Popular Discussions - InDesign Scripting
Viewing all articles
Browse latest Browse all 15932

Can you correct my unfunction my script?

$
0
0

Hi, everyone

 

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


Viewing all articles
Browse latest Browse all 15932

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>