GUI Scripting Help: Sub-Menus

I need help writing a script using gui scripting with Systems Events to access a sub-menu. The following example will get me to “Recent Items” of the Finder but I need to choose a selection within the “Recent Items” sub-menu:

activate application "Finder"
tell application "System Events"
	tell process "Finder" to click menu item 9 of menu 1 of menu bar item 1 of menu bar 1
end tell

I need to get to the next level down within the sub-menu to make a selection. Any help is appreciated. Thanks.

Try something like this:

tell application "System Events"
	tell (first process whose frontmost is true) to click menu item 2 of menu 1 of menu item 9 of menu 1 of menu bar item 1 of menu bar 1
end tell

Perfect. Thanks Bruce.

I need to go one step further and check and uncheck a box but havent a clue as to how or even what they are called. They don’t show up in the directory.
Need to turn Motion Detection on and off in SecuritySpy while leaving the camera active for other recording.

Any help is greatly appriciated,
Riley Aldrich