Quark document 'zoom button' (the green one on the window)

Hi there,

I thought this may be fairly easy to do but I seem to be having problems. I’ve tried a few variations from info I’ve found on the web but no luck.

What I’m trying to do is put together a script that will open Quark documents dropped onto it and then maximise the window using the green button on the top left of the window.

Here’s what I’ve got so far:-

on open (someFiles)
	
	repeat with theFile in someFiles
		
		tell application "Finder"
			open theFile using application file "QuarkXPress" of folder "QuarkXPress 6.1" of folder "Applications" of startup disk
		end tell
		
		tell application "System Events"
			if UI elements enabled then
				set FrontApplication to (get name of every process whose frontmost is true) as string
				tell process "QuarkXPress"
					delay 1
					
					click button 2 of window 1
					--button 2 is the green "zoom" button for all applications
					--window 1 is always the frontmost window.
				end tell
			else
				tell application "System Preferences"
					activate
					set current pane to pane "com.apple.preference.universalaccess"
					display dialog "UI element scripting is not enabled. Check 'Enable access for assistive devices'"
				end tell
			end if
		end tell
		
	end repeat
	
end open

This is just one of the versions I’ve tried but when it comes to maximising the document window I get nothing.

I’ve tried using the UI Inspector and going down that route but no luck.

Please can someone point me in the right direction.

Thanks in advance,

Nick

Hi Jacques,

Thanks for your help with this query.

Your solution worked fine, thanks.
I took it a stage further to change the view of the current document too.

Thanks again for your time,

Nick