Pop-Up Menu with application variables

OK… I’m a noob, and I know I’m going to get flamed… but I need a bit of help.

I’ve prototyped an application script in AppleScript, and it works pretty well. What I don’t like about it is the user interface. Without offering up nearly 2,000 lines of script… the basic idea is that the script interrogates the system to determine a list of possible actions that could be taken and stores the options as a series of dynamic variables with some text formatting for easy comprehension by the user. These are then displayed in a simple display dialog:

set MenuItem1 to “[1] option thing one”
set MenuItem2 to “[2] option thing two”
set MenuItem3 to “[3] option thing three”
set MenuItem4 to “[4] option thing four”
… etc. etc.

display dialog "The following things to do were found:

" & MenuItem1 & MenuItem2 & MenuItem3 & MenuItem4 & …etc.etc. &
"
Only one thing should be done at a time." with title appname & " " & appver default answer “1” buttons {“Do It”, “Un-Do It”, “Quit”} cancel button “Quit” default button 1

ok… now my problem. The interface is just displayed text and a textbox. I need to make this into a pup-up box, but in order to have more than two buttons I need to do this in Xcode (which is ok, as I’d also like to lock the code up and allow for it to be minimized, etc. etc.). … but for the life of me I can’t figure out how to create a pop-up in interface builder that displays the variables created by the script… and I can’t predict and write in every possible menu label combination to perform a match against. … so I’m very stuck.

Who has the magic I’m missing? Is there a simple way to do this in AppleScript Studio context?

AppleScript Studio is next door; you’re in AppleScriptObjC land here.

So, “Applescript Studio” is deprecated, if you’re using a current system (ie 10.6) you’ll be using Applescript Objective-C and XCode, which essentially is the old AScript Studio, but new and sparkly.

What you’ll do is something along these lines.
-Make your UI in IB Interface Builder
-In code have a property for the popup menu (… property thePopupMenu : missing value )
-Connect the code item thePopupMenu to the actual item in IB
-In code, you’ll be able to tell thePopupMenu to remove all the items, and make new items on the fly. The menu will then depopulate/populate as you do this

check out the XCode help for NSPopUpButton, and then the methods: “ addItemWithTitle:, “ removeAllItems, “ selectedItem

You’ll need to get up to speed on the ASOC updates and change up your script somewhat.

Chris