Is there an easier(shorter) way to reference a object?

For example I know the AS names of all my elements so would there be a shorter way of doing something like this?

on clicked theObject
	if title of theObject is "Update" and title of current cell of matrix "updaterItemTypeSwitch" of tab view item "updaterTabView" of tab view "tabView" of window "swapsManagerWindow" is "General" then
		generalUpdate()
	else
		classUpdate()
	end if
end clicked

The properties superview and window are useful if you can use them correctly. Try something like this:

on clicked theObject
	if title of theObject is "Update" and title of current cell of matrix "updaterItemTypeSwitch" of (theObject's super view) is "General" then
		generalUpdate()
	else
		classUpdate()
	end if
end clicked

Check your project’s dictionary (AppleScriptKit.sdef) for view under the “Control View Suite”:

Another thing you can do, is to code your objects in ASS as you would handle them in obj-c. In obj-c, you typically connect all of your interface elements to controllers (classes) in your app, and the references to them are established once… at runtime. There’s really no way to do this in ASStudio, other than to use one of the handlers that fires at or shortly after launchtime and set a property variable as a persistent reference to each object. I personally usually do this in the “awake from nib” handler.

What I pretty much always do no matter the complexity of the app is set up references to my main containers like windows or tab views. Also, as I develop the app and I come to realize which objects are getting referenced a lot, I create variable references to them as well. If you’ve only got a few objects to create persistent references for, you can set up simple connections for each to the awake from nib handler. If you have large amounts of references to make, you can also clean up your code by creating subroutines that initialize all of your references in one clean chunk of code.

property swapsManagerWindow : ""
property theTabView : ""
property updaterTabViewItem : ""
property updaterItemTypeSwitch_Matrix : ""

on awake from nib theObject
	if name of theObject is "MainWindow" then
		set swapsManagerWindow to theObject --> Reference the window using 'swapsManagerWindow'
		initializeSwapsObjects() --> Initialize multiple objects in a subroutine
	else if name of theObject is "tabView" then
		set theTabView to theObject --> Reference the tab view using 'theTabView'
	end if
end awake from nib

on clicked theObject
	if (name of theObject is "Update") and (title of current cell of updaterItemTypeSwitch_Matrix)) is "General") then
		generalUpdate()
	else
		classUpdate()
	end if
end clicked

to initializeSwapsObjects()
	(* Set up a reference to the tab view item *)
	set updaterTabViewItem to tab view item "updaterTabView" of tab view "tabView" of swapsManagerWindow
	(* Set up a reference to the matrix *)
	set updaterItemTypeSwitch_Matrix to matrix "updaterItemTypeSwitch" of updaterTabView
end initializeSwapsObjects

As a side note, I usually try to avoid referencing objects by their title. Applescript affords us the use of an applescript name for EVERY object. As you develop more and more complex applications, you’ll find that you often need the flexibility of having multiple items with the same title attached to a handler. By getting in the habit of only testing for the name of an object, you’ll offer yourself a lot more flexibility and cut down on rewriting the interface and all of your handlers when you decide to make changes or additions later.

Good luck,
j

Thanks to the both of your for the help and the info =)