List Playlists in PopUp Button

I would really appreciate any help with this.

I am creating an alarm clock where I can select an iTunes playlist in a PopUp List. How do I list the playlists and record the selection?
Thanks you.

You can connect the popup button to an awake from nib handler:

on awake from nib theObject
	tell menu of theObject to delete menu items
	tell application "iTunes"
		launch
		name of user playlists
	end tell
	
	repeat with thisItem in result
		tell menu of theObject to make new menu item at end of menu items with properties {title:thisItem}
	end repeat
end awake from nib

Bindings are one option for saving preferences.

Awesome! Thanks!

Another question…if I were to list the playlists in a dialog box as shown below:

	set this_playlist to (choose from list the_playlists with prompt "Choose a playlist:" OK button name "Play" default items {last_choice}) as Unicode text

Could I ’ attach to window “main” ’ at all? I have tried with no luck
Thanks.

No, you can’t. The display dialog and display alert commands in an AppleScript Studio apps are overriding the ones in Standard Additions (so that they can include parameters such as attach to).

Hi Mr Handsome

you could attach a “panel” to your main window, add a “NSTextView” to it which displays your playlist to which you can select from.

Budgie

Budgie -

Thanks for that info. Any chance you could show me the code I would need to do that. I’m still somewhat new to this.
Again, big thanks.

Figured it out. Thanks.