set popup items of popup menu

Hi, I’m a newbie to Xcode, and I’m having some trouble setting the menu items in a popup menu. I want to load the name of every file in a folder to the pop up menu. I can enter the name of every file of the folder to a text view, but I can’t quite translate it to a popup menu.

Heres the code I’ve been using for the text view:


 on clicked theObject
end clicked

on awake from nib theObject
	tell application "Finder"
		set a to ((name of every file) of folder "system HD:Library:Scripts:2.my sites:" as list) as text
	end tell
	set contents of (text view "text" of scroll view "text" of window "main") to a
end awake from nib

on action theObject
	(*Add your script here.*)
end action

If anyone can point me in the right direction, I’d be very greatful!
Many thanks,
truth

tell application "Finder"
	set a to ((name of every file) of folder "system HD:Library:Scripts:2.my sites:" as list)
end tell

tell window "myWindow"
	delete every menu item of menu of popup button "myButton"
	repeat with tmpItem in a
		make new menu item at the end of menu items of menu of popup button "myButton" with properties {name:tmpItem, title:tmpItem, enabled:true}
	end repeat
end tell

…found easily at apple’s developer connection via google.

j

Thanks jobu, that was just the ticket. I don’t know how I missed that page on developer connection. I must have read over it a dozen times and it was staring me in the face all along. Anyway, thanks again for the code. Hope I can return the favor some time.

Peace,
truth