Quark: converting styled to tagged and chained boxes

I have a client using Quark, and we are trying to strip text out of their documents (one article at a time) and put the info in a database for publication on the web. The script below (although it needs a lot of work), basically getting some of it done.


tell application "QuarkXPress Passport"
	activate
	set thisbox to current box
	set wordcount to count of (words of thisbox whose style is italic)
	repeat with loopvar from 1 to wordcount
		set theWord to (object reference of first word of thisbox whose style is italic)
		set style of characters in theWord to plain
		set text of theWord to ("<i>" & (text of theWord) & "</i>")
	end repeat
	set every text in thisbox where it is "</i> <i>" to " "
	set wordcount to count of (words of thisbox whose style is bold)
	repeat with loopvar from 1 to wordcount
		set theWord to (object reference of first word of thisbox whose style is bold)
		set style of characters in theWord to plain
		set text of theWord to ("<b>" & (text of theWord) & "</b>")
	end repeat
	set thistext to text of thisbox
end tell


problems:

  1. this code doesn’t REALLY do what I want… I was trying to use ‘text style ranges’ but just couldn’t get it to work.
  2. text that is plain AND bold is not processed for the bold style
  3. since this is based on getting the text of the text box, when the client uses chained text boxes, the text outside this box is not processed.

I’ve been working on this for a while and Quark Applescript has always been a problem for me!

Any help or suggestions would be greatly appreciated.

Thanks in advance for your time!

Steve

Ok. As I understand well, I think this script does exactly what you want. Not in Quark, but in tex-Edit.
You can export the text as rtf-file and drop it on the droplet.
(PS: check the way how I made a repeat loop for the styles in this script.)

However, if you want to change bold italic in Quark use this.

Hope this works.
Kjeld

tell application "QuarkXPress Passport"
	activate
	set BoldItalic to {on styles:{bold, italic}, off styles:{plain, underline, outline, shadow, superscript, subscript, superior, strikethrough, all caps, small caps, word underline}}
	
	set thisbox to current box
	set wordcount to count of (words of thisbox whose style is BoldItalic)
	repeat with loopvar from 1 to wordcount
		set theWord to (object reference of first word of thisbox whose style is BoldItalic)
		set style of characters in theWord to plain
		set text of theWord to ("<bi>" & (text of theWord) & "</bi>")
	end repeat
	set thistext to text of thisbox
end tell