Skip to main content
Inspiring
October 14, 2013
Question

Select every character which does not have either of two character styles applied [AS]

  • October 14, 2013
  • 1 reply
  • 805 views

Seems straight forward but I'm not wrapping my head around phrasing this properly.

I need to get every character which does not have either character style applied....

Assume thetext is appropriately a text frame already assigned.

set thisbody to (every character of thetext whose name of applied character style is not "header" or "price" as string)

---This does not work

The long way to do this would be to get the text which has the styles I want to remove applied and then remove it from the string, but there should be an easier way to do this.

This topic has been closed for replies.

1 reply

October 15, 2013

My applescript is very rusty, but I vaguely recall some limitations to the "whose" clauses that often forced me to work around them. If that's what you've bumped into here, try looping thru all the of text style ranges in thetext to find the ones that use the character styles you're hunting.

lithodoraAuthor
Inspiring
October 15, 2013

I was hoping that was not the case, only because of the speed it would go.

October 15, 2013

I'm wondering about the syntax, too. Should it be:

(every character of thetext whose name of applied character style is not "header" or

whose name of applied character style is not "price")

Again, just off the top of my head. I don't have an AS editor handy.