Author Topic: restricting a search to ...  (Read 3421 times)

0 Members and 1 Guest are viewing this topic.

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: restricting a search to ...
« Reply #10 on: November 23, 2010, 03:44:08 PM »
No.

I need to add some sort of code here:

               if paragraph p contains ThisText then

to make sure that my search only finds bold strings.

almost like this:
if paragraph p contains ThisText in bold style then
 

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: restricting a search to ...
« Reply #11 on: November 29, 2010, 10:51:16 AM »
In other words, do the Tex Edit+ equivalent of this [QXP] search routine below:



Hope that makes sense.

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: restricting a search to ...
« Reply #12 on: November 29, 2010, 11:16:17 AM »
Sorry, i got sidetracked on this.

I believe the following should do what you want:

Quote
001     tell application "Tex-Edit Plus"
002          repeat with ThisText in RunInWords
003               set ThisText to ThisText as string
004               if (search paragraph p looking for ThisText looking for styles {style:{bold}}) then
005                    replace paragraph p looking for "^*" looking for styles {style:{bold}, color:blue} replacing with "@stylename:" replacing with styles {style:{bold}, color:green}
006               end if
007          end repeat
008     end tell
Notes:
The line numbers included with this script are there to aid future discussions. In order to use this script, you will have to strip them all from the code.


HTH
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: restricting a search to ...
« Reply #13 on: November 29, 2010, 01:54:39 PM »
Eureka! You've got it!

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: restricting a search to ...
« Reply #14 on: November 29, 2010, 02:14:23 PM »
Well, once I took the time to really read what you were asking instead of inferring/assuming, it all made sense to me.

Glad I could be of help!
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5