Find a word in QuarkXpress 6.5

Hi,

I have write as script to find certain words in the quark document.

Here is my script:

set allwords to {"Table", "Figure"}

tell application "QuarkXPress"
	tell document 1
		activate
		repeat with i from 1 to count of stories
			tell story i
				repeat with k from 1 to count of paragraphs
					tell paragraph k
						try
							set wds to (index of every word where it is in allwords)
						end try
					end tell
				end repeat
			end tell
		end repeat
	end tell
end tell

When I run this script, It will not find the word where it is in allwords array.
Could any one help me on this.

Thanks,
Gopal

Hi,

I guess you have to go thru “allwords” and compare it with the contents of a word …

This works with QXP 7.5

set allwords to {"Your", "words"}
set wds to {}

repeat with aitem from 1 to count of allwords
    set theitem to item aitem of allwords
    tell application "QuarkXPress Passport"
        tell document 1
            activate
            repeat with i from 1 to count of stories
                tell story i
                    repeat with k from 1 to count of paragraphs
                        tell paragraph k
                            
                            
                            try
                                set theindex to the index of (every word whose contents = theitem)
                                copy {"word " & theindex & " of paragraph " & k & " of story " & i & " is " & theitem} to end of wds --just to show all indexes as I don't know what you want to do with the result
                            end try
                            
                        end tell
                    end repeat
                end tell
            end repeat
        end tell
    end tell
end repeat

set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to return
"This is the result: " & return & (wds as text)
set AppleScript's text item delimiters to tid