Screenshot of Complex Sample Showing All Controls

@alldritt put it mildly:

My first concern was to identify and show an example of all Dialog Tooklit controls. The Complex sample.scpt provided by Shane appears to do that.

Here’s my first, small contribution.

I have modified this file to:

  • Set the label text to the name of the control/command.
  • Reformat the script to improve readability

Screenshot of All Dialog Toolkit Controls

Modified Script

(*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MY TEST Version of Shane's Complex sample.scpt
2017-08-24
JMichaelTX
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*)


--  This sample shows how to build a reasonably complex dialog, both using terminology and calling the handlers directly.

-- Dialog Toolkit.scptd should be in ~/Library/Script Libraries
use AppleScript version "2.4"
use scripting additions
use script "Dialog Toolkit" version "2.0"

set {instructionsField, instructionsLabel, theTop} to ¬
  create top labeled field ¬
    "" placeholder text ¬
    "Extra instructions go here" left inset 0 ¬
    bottom 0 ¬
    field width 400 ¬
    extra height 60 ¬
    label text "Top Labeled Field"

set {operatorField, operatorLabel, theTop, fieldLeft} to ¬
  create side labeled field (short user name of (system info)) ¬
    placeholder text ¬
    "Your name" left inset 0 ¬
    bottom (theTop + 8) ¬
    total width 400 ¬
    label text ¬
    "Side Labeled Field" field left 0

set {theRule, theTop} to ¬
  create rule (theTop + 12) ¬
    left inset 0 ¬
    rule width 400

set {thePathControl, pathLabel, theTop} to ¬
  create labeled path control (POSIX path of (path to documents folder)) ¬
    left inset 0 ¬
    bottom (theTop + 12) ¬
    control width 400 ¬
    label text ¬
    "Labeled Path Control" with pops up

set {theCheckbox, theTop, newWidth} to ¬
  create checkbox ¬
    "Checkbox" left inset 0 ¬
    bottom (theTop + 8) ¬
    max width 400 ¬
    without initial state

set {colorPopup, popupLabel, theTop} to ¬
  create labeled popup {"A very long, long color name", "Green", "Blue"} ¬
    left inset 0 ¬
    bottom (theTop + 8) ¬
    popup width 100 ¬
    max width 400 ¬
    label text ¬
    "Labeled Popup" popup left 0 --150


set {jobMatrix, matrixLabel, theTop, matrixLeft} to ¬
  create labeled matrix {"Press 1", "Press 2", "Press 3"} ¬
    left inset 0 ¬
    bottom (theTop + 8) ¬
    max width 400 ¬
    matrix left 0 ¬
    label text ¬
    "Labeled Matrix" without arranged vertically

set allControls to ¬
  {instructionsField, instructionsLabel, operatorField, ¬
    operatorLabel, theRule, thePathControl, ¬
    pathLabel, theCheckbox, colorPopup, ¬
    popupLabel, jobMatrix, matrixLabel}

set {buttonName, suppressedState, controlsResults} to ¬
  display enhanced alert ¬
    "Complex Sample" message ¬
    "" as critical alert ¬
    buttons {"Cancel", "OK"} ¬
    giving up after 120 ¬
    acc view width 400 ¬
    acc view height theTop ¬
    acc view controls allControls ¬
    without suppression

1 Like