Author Topic: How to apply Character style to the replacestring  (Read 1316 times)

0 Members and 1 Guest are viewing this topic.

Offline Star123

  • Visitor
  • Posts: 3
  • Karma: 0
How to apply Character style to the replacestring
« on: May 13, 2010, 01:34:28 PM »
Hi Everybody,
I got the below script from this forum.
Can it possible to apply a character Style to the replacestring "Goodbye"

SAndR("Hello", "Goodbye")

on SAndR(searchstring, replacestring)
     tell document 1 of application "QuarkXPress"
          try
               set (every text of every story where it is searchstring) to replacestring
          end try
     end tell
end SAndR


Thanks
Star

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: How to apply Character style to the replacestring
« Reply #1 on: June 22, 2010, 11:33:32 AM »
Hi Star.

I think you could do it by just adding another search

               set character style of every text of every story where it is replacestring to "x"

like so:

on SAndR(searchstring, replacestring)
     tell document 1 of application "QuarkXPress"
          try
               set (every text of every story where it is searchstring) to replacestring
          end try
          try
               set character style of (every text of every story) where it is replacestring to "x"
          end try
     end tell
end SAndR