Working with Quark6 Text and Special Characters
Working with Quark6 Text and Special Characters
- Subject: Working with Quark6 Text and Special Characters
- From: Jason Bourque <email@hidden>
- Date: Wed, 13 Oct 2004 16:08:15 -0400
Title: Working with Quark6 Text and Special Characters
Hello,
I have a script that goes through each paragraph and formats pricing in a catalog.
I works great, superscripts the dollar symbol and bolds the price and skips standard pricing when sale pricing applies.
Well a few text box have multiple columns and I use the enter key to force the text to the next column. When the script runs across this character it
doesn’t count it as a paragraph so the paragraph count fails one behind and formats the paragraph before the one it should.
If I remove the character and just add some returns it works fine. Any advise on working with this character?
Thanks,
Jason Bourque
tell application "QuarkXPress 6"
activate
tell document 1
if not (exists current box) or box type of current box is not text box type then error "A single text box must be selected."
set vSelection to current box
tell vSelection
try
set vEveryText to every text
tell story 1
try
set style of every character where it is "$" to plain
set style of every character where it is "$" to superior
end try
try
set style of every character where it is "¢" to plain
set style of every character where it is "¢" to superior
end try
end tell
on error
set vEveryText to ""
end try
end tell
-- return result
set vStoryCount to count of vEveryText
set vParaCount to count of paragraphs of vEveryText
set vParaStyleNames to name of paragraph style of every paragraph of story 1 of vSelection
-- return {vParaCount, vParaStyleNames}
set vPriceFlag to false
set vBoldOffset to 0
repeat with vNth1 from 1 to vParaCount
set vParaNth to paragraph vNth1 of vEveryText
set vParaStyleNth to item vNth1 of vParaStyleNames
if (vNth1 is not vParaCount) and ¬
(((paragraph (vNth1 + 1) of vEveryText) starts with "Sale Price") or ¬
((paragraph (vNth1 + 1) of vEveryText) starts with "Discount Price") or ¬
(vParaNth contains "Reg. Price")) then
set vSalePriceFlag to true
else
set vSalePriceFlag to false
end if
if (vParaStyleNth begins with "Price Line") and (vSalePriceFlag is false) and (vParaNth does not contain "Reg. Price") then
if (vParaNth starts with "Sale") or (vParaNth contains "Sale") or (vParaNth starts with "Discount") then
copy {true, 1} to {vPriceFlag, vStartBoldNum}
else
copy {0, 0} to {vStartBoldNum, vEndBoldNum}
end if
if vParaNth contains "¢" then
set vCentFlag to true
else
set vCentFlag to false
end if
set vParaTextCount to count of vParaNth
repeat with vNth2 from 1 to vParaTextCount
set vCharacterNth2 to character vNth2 of vParaNth
tell vSelection
tell story 1 of vSelection
if (vCharacterNth2 is "$") then
copy {true, vNth2} to {vPriceFlag, vStartBoldNum}
end if
if (vCharacterNth2 is tab) then
if vCentFlag then
copy {true, vNth2 + 1} to {vPriceFlag, vStartBoldNum}
else if vPriceFlag then
copy {false, 1} to {vPriceFlag, vBoldOffset}
end if
end if
if ((vPriceFlag is false) or (vNth2 is vParaTextCount)) and vStartBoldNum is not 0 then
copy (vNth2 - vBoldOffset) to vEndBoldNum
set style of characters vStartBoldNum thru vEndBoldNum of paragraph vNth1 to {on styles:{bold}}
-- Reset Variables
copy {0, 0, 0} to {vStartBoldNum, vEndBoldNum, vBoldOffset}
end if
end tell
end tell
end repeat
set vPriceFlag to false
end if
end repeat
end tell
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden