2 Quick Inquiries: Display Dialog & Radio Buttons

Hi expert scripters!

Novice/Intermediate scripter here. Thanks to all the support and online resources, I’ve managed to create a few super useful tools with AppleScript for my team, which I’m super proud of. I’ve got two quick questions that I couldn’t find solid answers online on my own.

First, many of my scripts require a pop-up window. It can be Display Dialog with customized buttons or Choose From List options. The issue is that if I have multiple desktops, and I execute the script with a keyboard shortcut/command from a 3rd party tool (TextExpander), the pop-up window would only appear at the desktop where the script is executed. For example, if I have TextExpander placed on Desktop1 and I’m working on Desktop2, I entered my keyboard command to run the script via TextExpander, the pop-up window would only appear on Desktop1 while I’m on Desktop2.

Is there any scripting solution to that or must I just change the way the script is executed? (For example using drop-down menu with the Editor Menu option, or creating a Quick Action with the script in my mac, etc)

Second, can AppleScript create dialog with multiple radio buttons? From reading the Mac Automation Scripting guide, it doesn’t appear AppleScript is capable of generating radio buttons. The goal is to gather multiple Y/N questions from user without having to pop up 4-5 windows asking Y/N.

Your insight is much appreciated!

Sure. Go here:

https://www.macosxautomation.com/applescript/apps/Script_Libs.html

and download Dialog Toolkit Plus.

The perfect answer is given by Shane’s Dialog Toolkit Plus.

Have a look at its Complex sample.scpt file.

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) mercredi 24 avril 2019 16:18:26

WHAT!!! LOL wow this is SUPER interesting. Thank you so much for sharing this. I’m so noob with the scope of AppleScript I get surprised everytime I ask a question here.

So if I’m interpreting this correctly, one could “script” using AppleScript to expand the default capability of AppleScript? That’s wild. :lol:

Thank you KniazidisR! I think I may have not made my inquiry clear. I’m not trying to have multiple pop-up windows at once. The issue is “where” the pop-up window will appear from the display dialog command. When you have multiple desktops created on your Mac and you execute your script by using a 3rd party tool via my pre-defined keyboard shortcut, the pop-up window will only appear on the desktop where the 3rd party tool is located. Therefore if I’m working on Desktop 2 I will have to switch to Desktop 1 to operate the pop-up window.

But given what you said, it appears that display dialog has it’s limit.

I thought I can do something simple like


display dialog in desktop 2

but evidently that’s not how it works lol

Regardless, I appreciate your input greatly!

Looking at previous responses, it looks like the Radio Button question was answered (use Shane’s Dialog Toolkit), but I it doesn’t look like there’s an answer regarding getting the dialog on the right desktop.

There may be situations where this doesn’t work - but you might try something like this:


tell application "System Events" to set appPath to (path to the frontmost application)
set appName to the name of (info for appPath)
set appName to text 1 thru ((offset of "." in appName) - 1) of appName

tell application appName
	display dialog "whatever"
end tell

So it finds out what application is in front, then always has that application display the dialog.

That is GENIUS!!! I will try that out for sure!! MUCH appreciated!