acting on the result of a checkbox in Dialog Toolkit +

Hi all,

A frequent contributor to this site, Shane Stanley, developed an awesome script library, called Dialog Toolkit, that I’ve discovered recently and have been using to build out a custom dialog for an applet I’ve created. However, I’m trying to figure out how to put the result of a checkbox that I’ve created through this library back into my script to act on it. The snippet of code is below; any help would be greatly appreciated. The checkbox returns true or false values, which is perfect, but I need to find out which values specifically the checkbox is returning. I also would like to designate default and cancel buttons, which gives me an error every time I try to do so.

Thanks so much,

Rocco


use scripting additions
use script "Dialog Toolkit Plus" version "1.0"

set theMessage to "FloTools has detected that your current operating system is Mac OS Mojave. Due to Mojave's new security measures, you will be presented with multiple permission dialogs from this installer after proceeding. You must click OK in all of the dialogs that appear in order for FloTools to be properly installed." & return & "If the installer becomes busy or unresponsive for a long period of time, there may be a hiding system dialog that needs confirmation before continuing."
set {theCheckbox, theTop, newWidth} to create checkbox "I have read and understand the information in this dialog." bottom 0 max width 400 without initial state
repeat until result is true
	set {buttonName, suppressedState, controlsResults} to display enhanced alert "Security Alert:" message theMessage as informational alert buttons {"Cancel", "Next"} acc view width 650 acc view height theTop acc view controls {theCheckbox} without suppression
end repeat


I tested with a slightly modified code


use scripting additions
use script "Dialog Toolkit Plus" version "1.0"

set theMessage to "FloTools has detected that your current operating system is Mac OS Mojave. Due to Mojave's new security measures, you will be presented with multiple permission dialogs from this installer after proceeding. You must click OK in all of the dialogs that appear in order for FloTools to be properly installed." & return & "If the installer becomes busy or unresponsive for a long period of time, there may be a hiding system dialog that needs confirmation before continuing."
set {theCheckbox, theTop, newWidth} to create checkbox "I have read and understand the information in this dialog." bottom 0 max width 400 without initial state
repeat 5 times --until result is true
	set {buttonName, suppressedState, controlsResults} to display enhanced alert "Security Alert:" message theMessage as informational alert buttons {"another", "Annuler", "otherOne", "Next"} acc view width 650 acc view height theTop acc view controls {theCheckbox} without suppression
	log result
	log (class of controlsResults)
	
end repeat


Here is what I got:
checking the box & clicking Next
(Next, false, true)
(list)
checking the box & clicking otherOne
(otherOne, false, true)
(list)
checking the box and pressing return
(Next, false, true)
(list)
unchecking the box and clicking Annuler
(Annuler, false, false)
(list)
unchecking the box and pressing escape
(Annuler, false, false)
(list)

The state of the checkbox is item 1 of controlsResults
The default button is the last one of the given list of buttons.
The Cancel one is the button whose name is “Cancel” or the localized cancel string - in French it’s “Annuler”.
“Cancel” is accepted worlwide as the cancel button.

use scripting additions
use script "Dialog Toolkit Plus" version "1.0"

set theMessage to "FloTools has detected that your current operating system is Mac OS Mojave. Due to Mojave's new security measures, you will be presented with multiple permission dialogs from this installer after proceeding. You must click OK in all of the dialogs that appear in order for FloTools to be properly installed." & return & "If the installer becomes busy or unresponsive for a long period of time, there may be a hiding system dialog that needs confirmation before continuing."
set {theCheckbox, theTop, newWidth} to create checkbox "I have read and understand the information in this dialog." bottom 0 max width 400 without initial state
repeat 5 times --until result is true
	set {buttonName, suppressedState, controlsResults} to display enhanced alert "Security Alert:" message theMessage as informational alert buttons {"another", "Annuler", "otherOne", "Next"} acc view width 650 acc view height theTop acc view controls {theCheckbox} without suppression
	log result
	log ("the box is checked : " & item 1 of controlsResults)
	if buttonName is "Annuler" then exit repeat
end repeat

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) samedi 2 mars 2019 10:53:45