I need to change the first sentence to bold

Discuss AppleScripting for QuarkXPress 10, 9 & 8 (and before)

I need to change the first sentence to bold

Postby mark lane » 08 May 2014, 09:42

I need to change the first sentence to bold in every paragraph and I didn't see anything that would control a sentence.

Thanks
Mark
mark lane
 
Posts: 44
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Postby Sirish Nair (Quark) » 08 May 2014, 18:54

Hi mark lane,
You can use a Conditional style where you define that a stylesheet having bold styling is applied to 1 Number of sentence. You can repeat the rule for every paragraph.

~Sirish
User avatar
Sirish Nair (Quark)
Quarkian
Quarkian
 
Posts: 576
Joined: 15 Mar 2005, 09:57
Location: India

I need to change the first sentence to bold

Postby mark lane » 09 May 2014, 02:09

Thanks for the reply Sirish, I'm still using quark 8.1.6 because of the slowdowns in the upgrades. I would rather do it in a script because there is some other things I would like to do. For example there is a price at the in of each paragraph that I need to change to end with .95.

Thanks
mark lane
 
Posts: 44
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Postby mark lane » 09 May 2014, 10:00

This is what I have so far, but I cant get the first sentence to repeat down to paragraph 2,3,4 and so on. Everything else repeats great.
tell application "QuarkXPress"
tell document 1
set TextBoxNumber to current box
set ParNum to 1
tell selection
repeat with P from (count of paragraphs) to 1 by -1
tell paragraph ParNum
if paragraph 1 contains "." then
set fullstop to (offset of first text where it is ".") in paragraph 1
set fullstart to (offset of first text) in paragraph 1
set fullstart to fullstart + 1
set fullstop to fullstop + 1
set font of text from character fullstart to character fullstop in paragraph 1 to "Optima LT Std Bold"
tell character -2 of paragraph 1
set contents to ("5")
end tell
end if
set size to 8
end tell
set ParNum to ParNum + 1
end repeat
end tell
end tell
end tell
mark lane
 
Posts: 44
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Postby mark lane » 09 May 2014, 10:02

What I mean I cant get the first sentance to BOLD in each paragraph in the repeat.
mark lane
 
Posts: 44
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Postby Jean-Marie Schwartz » 11 May 2014, 23:16

There are many mistakes in your code. I couldn't go into details so here is a better working code. Tell me if you need slightly different behaviour in some commands. HTH.
[b]tell application "QuarkXPress"
[b]tell document 1
[b]tell current box
[b]repeat [b]with P [b]from ([b]count [b]of paragraphs) [b]to 1 [b]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]is ".")) [b]to "Optima LT Std Bold"
[b]try
[b]tell character -2
[b]set contents [b]to ("5")
[b]set size [b]to 8
[b]end [b]tell
[b]end [b]try
[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: 2488
Joined: 23 Nov 2004, 04:30

I need to change the first sentence to bold

Postby mark lane » 12 May 2014, 02:16

Thanks, thats exactly what I needed.
mark lane
 
Posts: 44
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Postby mark lane » 12 May 2014, 02:47

What I have works, but there is probably a faster way to do my prices to bold. I have it check character -2 and then -3 and so on. All the way up to character -10. Is there a way to group all the -2 thru -10 into one statement?
if characters -2 thru -2 is in {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} then
tell character -2
set font to "Optima LT Std Bold"
end tell
end if
if character -3 is in {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} then
tell character -3
set font to "Optima LT Std Bold"
end tell
end if
if character -4 is in {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "$", ".", ","} then
tell character -4
set font to "Optima LT Std Bold"
end tell
end if
if character -5 is in {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "$", ".", ","} then
tell character -5
set font to "Optima LT Std Bold"
end tell
end if

Thanks
mark lane
 
Posts: 44
Joined: 27 Sep 2004, 14:16

I need to change the first sentence to bold

Postby Jean-Marie Schwartz » 12 May 2014, 03:34

Could you post what the paragraphs look like please? That way I could see better your starting point. Thanks.
Jean-Marie Schwartz
 
Posts: 2488
Joined: 23 Nov 2004, 04:30

I need to change the first sentence to bold

Postby mark lane » 12 May 2014, 04:35

There is a tab before Retail

BV116 Long Axe. 28" overall. 8" black finish stainless extra thick axe head with 5" cutting edge. Black rubberized grip. Bulk packed. Retail $1,44.95
BV127 Triple Spear Thrower Set. Includes three 9" overall throwing knives with 3 1/8" blade with drilled hole design. Features a piercing point and two razor sharp blades. One piece black finish AUS-6 stainless construction with black cord wrapped handle. Dual lanyard/lashing holes. Black nylon belt sheath holds all. Retail $20.95

Thanks
mark lane
 
Posts: 44
Joined: 27 Sep 2004, 14:16

Next

Return to QuarkXPress 8, 9 & 10: AppleScript

Who is online

Users browsing this forum: No registered users and 2 guests