Hi,
I told about something like this, actually:
#target indesign var mySelected = Number( app.extractLabel("mDialog") ), // previous selection's set myDialog = app.dialogs.add({name:"add continueds",canCancel:true}); if ( isNaN( mySelected ) ) mySelected = 0; with(myDialog){ with(dialogColumns.add()){ with(dialogRows.add()){ var mySelection = dropdowns.add({stringList:["Continued", "continued", "Cont'd","cont'd"], selectedIndex: mySelected}); } } } if (myDialog.show() == true) main(); myDialog.destroy(); function main(){ mySelected = app.insertLabel( "mDialog", String(mySelection.selectedIndex) ); // to remember selection's set if(app.selection.length && app.selection[0].hasOwnProperty ("contents") ) addContinueds(); else alert("Wrong selection. Please try again."); } function addContinueds() { app.findGrepPreferences = app.changeGrepPreferences = null; switch (mySelection.selectedIndex){ case 1: app.changeGrepPreferences.changeTo = "$1 (continued)"; break; case 2: app.changeGrepPreferences.changeTo = "$1 (Cont'd)"; break; case 3: app.changeGrepPreferences.changeTo = "$1 (cont'd)"; break; default: app.changeGrepPreferences.changeTo = "$1 (Continued)"; break; } app.findGrepPreferences.findWhat = "(.)$"; app.selection[0].paragraphs[-1].changeGrep(); // NOTICE: the last paragraph of selection is targeted app.findGrepPreferences = app.changeGrepPreferences = null; }
There is app.insertLabel() used for keeping previous selection index
Jarek