Author Topic: restrict script to act just upon selected text  (Read 1141 times)

0 Members and 1 Guest are viewing this topic.

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
restrict script to act just upon selected text
« on: May 12, 2008, 01:18:12 PM »
Hey again,

Want to have my find/change script JUST run on the text I have selected.

Not sure how to word the "Tell selection" part...

Here's the code:

tell document 1 of application "QuarkXPress"
   activate
   tell current box
      tell story 1
         set every text where it is (ASCII character 32) to (ASCII character 9)
      end tell
   end tell
end tell


Anyone ever done this?


Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: restrict script to act just upon selected text
« Reply #1 on: May 14, 2008, 11:10:54 PM »
Got it, courtesy of Matt-Boy from MacScripter:

to key was to remove the
   tell current box, tell story blocks.

like so:

tell document 1 of application "QuarkXPress"
   activate
   tell selection
       set every text where it is (ASCII character 32) to (ASCII character 9)
   end tell
end tell