Are dialogs with four or more actions possible?

To anyone who can help! I am using applescript studio and am contstructing an app that needs to perform actions based on multiple results. At the moment, I am able to execute only 3 actions as per a dialog with 3 actions, if, else if, else. How do I approach it if I require 4 or more actions? At the moment my text field is recieving results from radio buttons. Once the go button is hit, short from using my third action to activate a new nib to carry on the next dialog of 3 actions, I am stumped. I have tried trigering new scripts, jumping to different lines in the script and just about every other round about way I can think of. I need help from someone who knows what they are doing! Any suggestions?

I’m not entirely clear from your explanation, but I think you want this:

choose from list myList with prompt "please choose your poison"
-- you can add these properties as well: 
-- default items {list}; OK button name "whatever"; cancel button name "something"; with/without multiple selections; with/without empty selection.

K let me be more specific, I am constructing an app that switches the preset locations for the internet settings of ones computer. It has a text field marked location. The user selects from 4 or more radio buttons which list the locatioins. Once the radio button has been selected, the contents is updated into the text field, the when the button “Go” is pressed, the idea is that the location is then selected. NOw using the 3 action dialog of If, else if, else, I am able to cover the first 3 locations for the action of which is executed when “go” is pressed. HOwever, I can not add any more actions to the script cuz with this method, I am out of available allowable actions. I don’t know if your suggestion will help, but I wanna be clear so as not to miss any other opportunities for advice. By the way I am new at this whole game and its loads of fun, but hell a confusing…any pointers to tutorials that don’t assume you only want to make itune remotes and check stock quotes?? Cheers.

That is seriously one of the most confusing posts I’ve ever read. :confused: Not to insult you, but I can’t really figure out what you’re talking about.

First, text fields don’t receive results from anything. Second, real dialogs… as achieved by using the “display dialog” command… can not have radio buttons. So, how do radio buttons effect your code, exactly?

You don’t activate nibs, and you wouldn’t ‘load’ one either to access any more scripting abilities. Nib files are interface files that know nothing of scripts that evaluate them… other than that they are connected to them via the applescript connections you make in interface builder.

The only line that you wrote that really makes ANY sense, is…

Based solely on my presumptions, you’re either looking for a way to evaluate multiple items to determine one outcome, or you simply don’t understand that you can have multiple else if statements.

If the latter is the case then you can do something like the following in your clicked handler which I assume you’re using to submit your data from your interface…

on clicked theObject
	if name of theObject is "button1" then
		--> do something for button 1
	else if name of theObject is "button2" then
		--> do something for button 2
	else if name of theObject is "button3" then
		--> do something for button 3
	else if name of theObject is "button4" then
		--> do something for button 4
	else
		--> do something for all other buttons
	end if
end clicked

If this isn’t it, then maybe you’re trying to evaluate a complex system of multiple buttons that all interact with each other. You can evaluate this type of setup in a variety of ways, but the following code should give you some insights…

on clicked theObject
	if name of theObject is "submitForm" then
		set input1 to true
		set input2 to false
		set input3 to true

		if (input1 is true) and (input2 is true) then
			--> do something
		else if (input1 is true) and (input2 is false) then
			--> do something
		else if (input3 is true) then
			if input1 is true then
				--> do something
			else
				display dialog "Something"
			end if
		end if
	end if
end clicked

There are like a million-billion ways to code and word this, depending on the kludge you’ve created for yourself. Could you perhaps re-phrase this with a few more words so we can understand how exactly your objects and code is interacting. Any code you could post that you’re currently using, and a bit more clear understanding on your part of what you’re doing (possibly found by reading the documentation and looking through the sample projects), might enable us to have even a remote idea what you’re talking about.

j

K will try this again and attempt at being more clear. I have a text field that is being updated by the resulting selected radio buttons. This I have no problem with. NOw this text field contains location names. When the go button is pressed, the idea is that an action will be executed and the resulting location will be selected by the computer.

At the moment I am using this:

on clicked theObject
set buttonGo to contents of text field “type” of window “main”

if buttonGo is equal to "Home" then
	try
		
		tell application "Finder"
			activate
		end tell

and so on and so forth.

I repeat this action for each of the remaining fields that are available to be selected from the 4 radio buttons.

Now they all work fine for the first three, i.e:

if buttonGo is equal to “home” then …

else if buttonGo is equal to “Work” then…

else …

NOw if I tack on any more else’s or anything after the last chain in the 3 action dialog, nothing will happen for my remaining locations. I would ideally like to be able to have this app work for as many locations one may see fit to program into their locations presets, however at the moment, 3 is my limit.

I hope this clarifys the situation a bit more…thanks for the help.

I have tried modifying the script with the methods listed above but none of the above methods work completely. For method one, it works for “if” & the first “else if”. The rest of the following “else if” commands have no effect. For the second method, I am not sure why it doesn’t work, it may not be relevant to what I am trying to accomplish.

So in the end a somewhat feebles night sleep did the trick…after relizing that as many “else if” actions could be used, I figured out in the morning that my script was not working cuz I had “else if the buttonGo…” instead of “else if buttonGo…”

I had actually tried the multiple “else if” but I was being foiled by my inexperience, lack of sleep and the word “the”.

Thanks for the advice.