Skip to main content
Known Participant
April 19, 2021
Answered

Object style script

  • April 19, 2021
  • 1 reply
  • 1272 views

Hello! Does anyone know how to change the code below from "Object Style 1" to the currently selected object style that's selected? So that I don't need to input the style name, but click on the object and it'll find the other objects that have the same object style applied.

 

var combineMe = new Array;
app.findObjectPreferences = null;
app.findObjectPreferences.appliedObjectStyles = "Object Style 1"
found_list = app.activeDocument.findObject();
for (a=0; a<found_list.length; a++) {
if (found_list[a] instanceof TextFrame) {
combineMe.push(found_list[a]);
}
}
 
Any help would be appreciated. Thank you!
This topic has been closed for replies.
Correct answer brian_p_dts

See below. 

app.findObjectPreferences.appliedObjectStyles = app.selection[0].appliedObjectStyle.name;

1 reply

brian_p_dts
Community Expert
brian_p_dtsCommunity ExpertCorrect answer
Community Expert
April 19, 2021

See below. 

app.findObjectPreferences.appliedObjectStyles = app.selection[0].appliedObjectStyle.name;
ChannersAuthor
Known Participant
April 19, 2021

Thank you a ton!!