You can't.You were probably thinking of something like
but that doesn't work because app.selection.textStyleRanges.everyItem().appliedCharacterStyle returns an array, and arrays don't have a prperty 'name'.
Ok. thank you...
Then what is the difference between to get the fontstyle of selected text and character style of selected text. Both the fontstyle and character style are array but we can get the array of fontstyle values but could not get character style values. why?? Wats the difference??
Pls clear this doubt.
fontStyle is a string, appliedCharacterStyle is an InDesign object. That's why
produces an array of character style objects, and
an array of strings.
Ok thank you...
textStyleRanges is object but we can use everyitem of fontstyle. Like tat why cant we use for characterstyle like below.
Here, name is string both textstyleranges and applied characterstyle are object. So can we use everyItem for both textStyleRanges and appliedCharacterStyle??? but its returning error.
What do you mean by "but we can use everyitem of fontstye"?
You cannot use everyItem() on fontstyle.
The following line would throw an error:
Also this would produce an error:
There is no collection fontStyles, there is no collection appliedCharacterStyles, but there is a collection textStyleRanges with the method everyItem().
Searchable DOM documentations:
Or Jongware's DOM documentations here (also iChm files and older InDesign versions):
Thank you so much to made me clear....
Actually what i thought is, a word contains more than one fontstyle and appliedcharacterstyle. its array so tat we can use everyItem for that.
But now I understood. In DOM, textStyleRanges is collection so that we can use everyItem but the fontStyles and appliedCharacterStyles are not a collection. so we cant use everyItem for that.