I need to change the first sentence to bold

Discuss AppleScripting for QuarkXPress 10, 9 & 8 (and before)
mark lane
Posts: 4
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Post by mark lane » 12 May 2014, 05:48

I tried to reply a couple of time but it was blocked, may because of the word knife. There is a tab before Retail. I could have 20 - 30 paragraphs

BV116 Long. 28" overall. 8" black finish stainless extra thick with 5". Black rubberized grip. Bulk packed. Retail $1,44.95
BV132 Mini Covert. 2 1/4" closed framelock. 1 3/8" black finish stainless assisted opening tanto with extended tang. Black aluminum handles. Lanyard hole. Black stainless pocket clip with slot cutout design. Retail $11.95


Thanks

Jean-Marie Schwartz
Posts: 1168
Joined: 23 Nov 2004, 04:30

I need to change the first sentence to bold

Post by Jean-Marie Schwartz » 12 May 2014, 22:31

OK so the word Retail is always present in the paragraph and there is always a tab before it, right? Is there any tab elsewhere?

mark lane
Posts: 4
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Post by mark lane » 13 May 2014, 07:39

No, just one tab before Retail.

Jean-Marie Schwartz
Posts: 1168
Joined: 23 Nov 2004, 04:30

I need to change the first sentence to bold

Post by Jean-Marie Schwartz » 14 May 2014, 04:08

Then try this:
tell application "QuarkXPress"
tell document 1
tell current box
repeat with P from (count of paragraphs) to 1 by -1
[b]if paragraph P [b]contains "." [b]then
[b]tell paragraph P
[b]set font [b]of (characters -1 [b]thru ([b]first character [b]where [b]it [b]istab)) [b]to "Optima LT Std Bold"
[b]end [b]tell
[b]end [b]if
[b]end [b]repeat
[b]end [b]tell
[b]end [b]tell
[b]end [b]tell

Jean-Marie Schwartz
Posts: 1168
Joined: 23 Nov 2004, 04:30

I need to change the first sentence to bold

Post by Jean-Marie Schwartz » 14 May 2014, 04:09

Post pending moderation :-/Be patient!

mark lane
Posts: 4
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Post by mark lane » 30 May 2014, 03:01

For some reason no matter where I put the
set font of (characters -1 thru (first character where it is tab)) to "Optima LT Std Bold"
it says, error "Cant get every -1 from character 1 of paragraph 26 of current box of document 1 of application \"QuarkXPress\" to it whose it = \" \" of character." number -1728
It looks like it would work great, but I keep getting this error.
Thanks

Jean-Marie Schwartz
Posts: 1168
Joined: 23 Nov 2004, 04:30

I need to change the first sentence to bold

Post by Jean-Marie Schwartz » 01 Jun 2014, 21:15

Sorry! Just wrap that line (leaving it where I put it) in a try block (so add a line try before and end try after). HTH.

mark lane
Posts: 4
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Post by mark lane » 02 Jun 2014, 04:14

Thanks, I had a problem using the where it is tab, when I changed to where it is " " it didn't error and worked.

Thanks

Jean-Marie Schwartz
Posts: 1168
Joined: 23 Nov 2004, 04:30

I need to change the first sentence to bold

Post by Jean-Marie Schwartz » 02 Jun 2014, 04:39

Great! Indeed it depends on the versions of both applications and OS. Glad it's sorted out!

Post Reply

Return to “QuarkXPress 8, 9 & 10: AppleScript”