can't label a button

Ok, i upgraded to 10.6 and i’m not sure that was a good idea now.

I’m trying to label a popup button and am getting an error when i try to label it. I’m following the tutorial here.http://macscripter.net/viewtopic.php?id=24751 But when i run this code

on awake from nib theObject
	tell window 1
		set title of button "F2Go" to "F2..Go"
		
		tell menu of popup button "Popup"
			delete every menu item
			make new menu item at end of menu items with properties {title:"911"}
			
			make new menu item at end of menu items with properties {title:"Pictures"}
			
		end tell
		display dialog "Popup's value is" & (title of current menu item)
	end tell

I get the following error. “Can’t make <> of <> of window 1 into type Unicode text. (-1700)”
If i take out the display dialog the error changes to simply -1708. Thoughts?

I should say that i’ve turned applescript studio back on with the change to the interface builder com file.

Hi,

there’s missing reference

display dialog "Popup's value is" & (get title of current menu item of popup button "Popup")

Moved to correct forum. :slight_smile:

Stefan,
thanks. that was really irritating me. Although even with that suggestion, i’ve had to change the way that i’m going to do the selection. I was using a popup menu, but i was only using two menu items so, i’m going to do that instead with two button, i can get that to work.

I just can’t seem to figure out how to reference the popup menu’s current menu item from the on clicked theObject handler for the one button. It appears to be simpler to simply make two buttons that simply replace the popup menu item.