Referencing Various UI Elements

Hello All,

I’m wondering, is there a way I can know how to reference an object from IB in the Applescript side?

For example, if I have a button in a window, I can tell the window by it’s name I give it to look at a button by a name I give it.

I get that.

But, when I wanted to get the value of a text field in a tab view, it took me an hour just to figure out that it’s the tab view item of tab view of window.

Now, I have a date picker field that I need to get the contents of, and I have no idea what it’s called to get it’s value!

I’m sure someone here could simply tell me, but I’d like to know how I can figure out the path to something, and what that something is, by myself!



there is no common way, one method is to name an object in IB, connect it to the awake from nib handler and force an error,
then the reference will be displayed

on awake from nib theObject
	if name of theObject is "myObject" then
			theObject as integer
		on error e
			set {TID, text item delimiters} to {text item delimiters, "Can't make "}
			set e to text item 2 of e
			set text item delimiters to " into type integer."
			set e to text item 1 of e
			set text item delimiters to TID
			display dialog e
		end try
	end if
end awake from nib

The UIElementInspector from might help as well.