GUI scripting

Hi, guys,
I am new to scripting, and I got stuck on something simple. Would you please look at the following script.

tell application "System Events"
	global x
	set x to the application processes whose name contains "XYZ"
	set x to item 1 of x
	global y
	set y to windows of x
	set y to item 1 of y
	global theName
	set theName to the name of y
	get theName
end tell
tell application "System Events"
	tell process "XYZ"
		-- GUI Scripting statements:
		select row 1 of outline 1 of window theName
		
		
	end tell
end tell

When the window of the application I script is on the desktop the skript works. When the window is mininmized to the Dock, the script cannot address the window.

I tried to address the window directly, and it worked even if the window was minimized. The only thing was that the application added a number to the window each time I open the application, so I tried to make the script to ignore a part of the window’s name.

All comments are welcome.

Thank you in advance.

You may be able to get the window as an object directly from the app and then perform your GUI stuff. And some apps want to address a “window” of a “document”. If you send me more info about what you are doing, I may be able to offer a more detailed solution.

set MyWindow to window 1 of document 1 of application "XYZ"
	tell application "System Events"
		-- GUI Scripting statements: 
		select row 1 of outline 1 of MyWindow
	end tell

Lemeeno
Jeff Case