4 Buttons

display dialog “Hello” buttons {“1”, “2”, “3”, “4”}default button 1

Why won’t this simple script work?
I haven’t been able to use 4 buttons and I am wondering if there is a way to do that.
Thanks for all and any help!

You’ll need to use additional software, or AppleScript Studio/XCode, to get more than three buttons in a dialog. 24U Appearance OSAX provides up to five buttons.

– Rob

How would I do it in xcode?
Thanks again,

I can’t answer that question but someone might be able to help if you ask on the AppleScript Studio forum.

– Rob

Even in XCode, you can’t use the display dialog method to display more than 3 buttons. Instead, you have to create a custom interface (a window or a panel) in Interface Builder, add your buttons there. You also have to create code to handle the pressing of the buttons. Once done there, you have to call and open that window, and depend on the code that is attached to the buttons for your next actions.

This sounds complex, but it isn’t really that bad. Check the documentation and the example code that is provided with xcode and you should find everything you need.

Display dialog is just not equipped and was never intended to handle complex user interaction. I have abused it in the past with some complex series of dialogs, to the point where it seemed like a “Choose your own adventure” game. I have also tried some of the other scripting additions, but I try to avoid them. I like to use vanilla applescript whenever possible. Give XCode and swing.

Thank You so much. Do you know of any good xcode tuttorials online. Also, If I want to learn a Mac programming language, what would be a good one to learn and where could I learn it?