Leopard GUI scripting (newbie)

Be forewarned, I’m probably just making some newbie mistake, but a Google search finds a number of posts about unexpected results with Leopard, so I thought I would ask.

I didn’t get into trying to script this bit of GUI when I had Tiger, so I don’t know if this problem is unique to Leopard or not.

I’m trying to script this:

<AXApplication: “GraphicConverter”>

<AXMenuBarItem: “File”>

<AXMenuItem: “New”>

<AXMenuItem: “Video Grab Window”>

I’ve tried lots of variations and gotten lots of error messages. This is where I am right now:


tell application "GraphicConverter" to activate
tell application "System Events"
	tell process "GraphicConverter"
		tell menu bar 1
			click menu item "Video Grab Window" of menu item "New" of menu "File"
		end tell
	end tell
end tell

With this, the error message is:

System Events got an error: Can’t get menu item “Video Grab Window” of menu item “New” of “File” of menu bar 1 of process “GraphicConverter”.

If I look at <AXMenuBarItem: “File”> and change it to:

of menu bar item “File”

I get:

System Events got an error: Can’t get menu bar 1 of process “GraphicConverter”. Invalid index.

All help appreciated.

Thanks.

-Dave

Model: iMac Core 2 Duo with 10.5.1
AppleScript: 2.2
Browser: Safari 523.10.6
Operating System: Mac OS X (10.5)

Hi,

this should do it


activate application "GraphicConverter"
tell application "System Events"
	tell process "GraphicConverter"
		tell menu bar 1
			click menu item "Video Grab Window" of menu 1 of menu item "New" of menu 1 of menu bar item "File"
		end tell
	end tell
end tell

Translation:

<AXApplication: “GraphicConverter”> – of process “GraphicConverter”
of menu bar 1
<AXMenuBarItem: “File”> – of menu bar item “File”
of menu 1
<AXMenuItem: “New”> – of menu item “New”
of menu 1
<AXMenuItem: “Video Grab Window”> – menu item “Video Grab Window”

Right you are, that works.

It’s also syntax that I’ve never seen returned by any of my searches.

Thanks.

-Dave

.but the one and only right syntax :wink: