2 or 3 selection text frame this script run?
selection = app.activeDocument.selection; for (var j = 0; j<selection.length; ++j); var doc = app.properties.activeDocument, myOnjectStyle = doc.objectStyles.itemByName = "myObj1", myObjects, l; app.findTextPreferences = app.changeTextPreferences = null; app.findTextPreferences.findWhat = "^a"; myObjects = (app.selection && app.selection[j]).findText () || doc.findText (); l = myObjects.length; while(l--) myObjects[l].pageItems[0].appliedObjectStyle = myOnjectStyle; n = app.selection[j].textFrames.length; while (n >= 0) { try { var islem = app.selection[j].textFrames[n]; islem.appliedObjectStyle = "myObj2"; } catch(_) {} n--; }