Quark v6 script very slow

Hi,

I have written one Applescript for quark v6 to find if there is any manually styled fonts in the quark document.

The scripts works fine, but it takes more time to find the manual styled font.

Here is my script:

set exits to "no"

tell application "QuarkXPress"
	activate
	tell document 1
		repeat with story_Count from 1 to count of stories
			tell story story_Count
				repeat with i from 1 to count of text style ranges
					set theStyle to style of text style range i
					if (on styles of theStyle is equal to {italic}) or (on styles of theStyle is equal to {bold}) or (on styles of theStyle is equal to {bold, italic}) or (on styles of theStyle is equal to {italic, bold}) then
						display dialog "This document contains manual styled fonts"
						set exits to "yes"
						exit repeat
					end if
				end repeat
			end tell
			if (exits is equal to "yes") then
				exit repeat
			end if
		end repeat
	end tell
end tell

if (exits is equal to "no") then
	display dialog "No Manual fonts"
end if

What the script does is, it searches the currently opened quark document for manually style font. It the script find the manual styled fonts it displays the report. And also the script does not continued further once it finds manual styled fonts.

Could any one help me on how to speed up the script process.

Thanks,
Gopal

You can try Quark’s ‘do script’ function and run a compiled Quark script within a Quark tell block; usually speeds things up considerably.

tell application "QuarkXPress"
	
	set exits to "no"
	
	--compile the Quark script within Quark tell block
	script foo
		tell application "QuarkXPress"
			activate
			tell document 1
				repeat with story_Count from 1 to count of stories
					tell story story_Count
						repeat with i from 1 to count of text style ranges
							set theStyle to style of text style range i
							if (on styles of theStyle is equal to {italic}) or (on styles of theStyle is equal to {bold}) or (on styles of theStyle is equal to {bold, italic}) or (on styles of theStyle is equal to {italic, bold}) then
								display dialog "This document contains manual styled fonts"
								set exits to "yes"
								exit repeat
							end if
						end repeat
					end tell
					if (exits is equal to "yes") then
						exit repeat
					end if
				end repeat
			end tell
		end tell
	end script
	
	--run the above compiled script
	run script foo
	
	--display results in Quark
	if (exits is equal to "no") then
		display dialog "No Manual fonts"
	end if
	
end tell