0

I have a script which makes users choose from different options in a list. I want there to be three buttons; OK, Cancel and Help (display a dialog with guidance).

However, it seems that I cannot use the "buttons" parameter within a list.

So how do I add additional buttons? (with a custom name, that displays a dialogue)

Current script:

set MyList to {"A", "B", "C"}

set Chosen to 
    (choose from list MyList with title "Connect to" 
    with prompt "What do you want to connect to?" 
    OK button name "Connect" cancel button name "Abort" ---and help
    with multiple selections allowed) as text
Atle
  • 27
  • 1
  • 6

2 Answers2

1

Unfortunately choose from list supports only two buttons.

Alternatives are a (second) standard dialog which opens the list dialog or an AppleScriptObjC app with a custom dialog window.

vadian
  • 274,689
  • 30
  • 353
  • 361
0

While choose from list only supports two buttons, you can use AppleScriptObjC to create very rich alerts/dialogs. I recommend starting with Shane Stanley's free Myriad Tables Lib. Here's an example:

enter image description here

To learn more, read Chapter 26:Richer Interfaces of Shane's excellent $15 book Everyday AppleScriptObjC, available here. You could also look at Dialog Toolkit on the same page. Because Cocoa alerts and dialogs provide an "accessory view", you can put many additional controls in there.

Ron Reuter
  • 1,287
  • 1
  • 8
  • 14
  • 1
    Updated the link to the current location of Myriad Tables. Note that this product is no longer being maintained, but it is still usable. – Ron Reuter Jun 20 '20 at 22:50