### Basic Application Installer Configuration Source: https://swiftdialog.app/advanced/inspect-mode Example configuration for an application installer dialog. Includes title, message, preset, icon details, cache paths, button text, and a list of applications to install with their respective paths and icons. ```json { "title": "Installing Office Suite", "message": "Please wait while we install your applications", "preset": "preset1", "icon": "sf=apps.iphone.badge.plus", "iconBasePath":"/Users/Shared/icons/", "cachePaths": ["/Users/Shared/Downloads"], "button1text": "Please Wait...", "button1disabled": true, "autoEnableButton": true, "autoEnableButtonText": "Continue", "items": [ { "id": "microsoft_word", "displayName": "Microsoft Word", "guiIndex": 0, "paths": ["/Applications/Microsoft Word.app"], "icon": "Microsoft Word.png" }, { "id": "microsoft_excel", "displayName": "Microsoft Excel", "guiIndex": 1, "paths": ["/Applications/Microsoft Excel.app"], "icon": "Microsoft Excel.png" }, { "id": "microsoft_powerpoint", "displayName": "Microsoft PowerPoint", "guiIndex": 2, "paths": ["/Applications/Microsoft PowerPoint.app"], "icon": "Microsoft PowerPoint.png" } ] } ``` -------------------------------- ### Select and Install Applications Script Source: https://swiftdialog.app/examples/demo-scripts This script uses the Dialog application to present a list of software options to the user via checkboxes. It then simulates an installation process by updating a progress bar and displaying status messages. The script requires Dialog to be installed at /usr/local/bin/dialog. ```python #!/usr/bin/python3 import time import os import subprocess import json # [appname, install_trigger] app_array = [ ["Firefox","jamf policy -event FIREFOX"], ["Microsoft Edge", "installomator.sh microsoftedge"], ["Google Chrome", "installomator.sh googlechrome"], ["Adobe Photoshop", "jamf policy -event PHOTOSHOP"], ["Some Other Stuff", "jamf policy -event OTHERSTUFF"], ["Some More Stuff", "jamf policy -event MORESTUFF"] ] dialogApp = "/usr/local/bin/dialog" progress = 0 progress_steps = 100 progress_per_step = 1 # build string array for dialog to display app_list = [] for app_name in app_array: app_list.append(["⬜️",app_name[0],app_name[1]]) def writeDialogCommands(command): file = open("/var/tmp/dialog.log", "a") file.writelines("{}\n".format(command)) file.close() def updateDialogCommands(array, steps): string = "__Installing Software__\\n\\n" for item in array: string = string + "{} - {} \n".format(item[0],item[1]) writeDialogCommands("message: {}".format(string)) if steps > 0: writeDialogCommands("progress: {}".format(steps)) # app string app_string = "" for app_name in app_array: app_string = "{} --checkbox '{}'".format(app_string, app_name[0]) # Run dialogApp and return the results as json dialog_cmd = "{} --title 'Software Installation' \ --message 'Select Software to install:' \ --icon SF=desktopcomputer.and.arrow.down,colour1=#3596f2,colour2=#11589b \ --button1text Install \ -2 -s --height 420 --json {} ".format(dialogApp, app_string) result = subprocess.Popen(dialog_cmd, shell=True, stdout=subprocess.PIPE) text = result.communicate()[0] # contents of stdout #print(text) result_json = json.loads(text) print(result_json) for key in result_json: print(key, ":", result_json[key]) for i, app_name in enumerate(app_list): #print(i) if key == app_name[1] and result_json[key] == False: print("deleting {} at index {}".format(key, i)) app_list.pop(i) print(app_list) # re-calc steps per item progress_per_step = progress_steps/len(app_list) os.system("{} --title 'Software Installation' \ --message 'Software Install is about to start' \ --button1text 'Please Wait' \ --icon SF=desktopcomputer.and.arrow.down,colour1=#3596f2,colour2=#11589b \ --blurscreen \ --progress {} \ -s --height 420 \ &\ ".format(dialogApp, progress_steps)) ``` -------------------------------- ### Multiselect List Example Source: https://swiftdialog.app/advanced/select-lists Example command to create a multiselect list, allowing multiple options to be chosen. Selected items are returned as a comma-separated string. ```bash --selecttitle "Choose options",multiselect --selectvalues "Option One, Option Two, Option Three, Option Four" ``` -------------------------------- ### Example: Initializing and Updating List Statuses Source: https://swiftdialog.app/advanced/item-lists Demonstrates initializing a list with multiple items and then updating their statuses individually using commands. ```bash echo "list: Test item 1, Test item 2, Test item 3" >> /var/tmp/dialog.log ``` ```bash echo "listitem: Test item 1: Complete ✅" >> /var/tmp/dialog.log ``` ```bash echo "listitem: Test item 2: There was an error processing this item ❌" >> /var/tmp/dialog.log ``` ```bash echo "listitem: Test item 3: wait" >> /var/tmp/dialog.log ``` -------------------------------- ### Install Dialog with Installomator Source: https://swiftdialog.app/reference/updates Use Installomator to install Dialog. This command downloads and runs the Installomator script to install Dialog. ```shell ./Installomator.sh dialog ``` -------------------------------- ### Required Select List Example Source: https://swiftdialog.app/advanced/select-lists Example command to create a required select list. The user must select a value before swiftDialog exits. ```bash --selecttitle "Required item",required --selectvalues "Option One, Option Two, Option Three" ``` -------------------------------- ### Example: Execute a Say Command Source: https://swiftdialog.app/examples/shell-commands Demonstrates executing a simple shell command like 'say thank you for running dialog' using the `--button1shellaction` parameter. ```shell --button1shellaction "say thank you for running dialog" ``` -------------------------------- ### Multiselect Output Example Source: https://swiftdialog.app/advanced/select-lists Example of the output format for a multiselect list, showing selected items as a comma-separated string. ```bash "Choose options" : "Option One, Option Three" ``` -------------------------------- ### Web Content and List Items in Presentation Source: https://swiftdialog.app/advanced/presentation This example demonstrates using presentation mode with web content in the info area and list items in the main content area. ```shell dialog --presentation --infobox "" --listitem ...... ``` -------------------------------- ### Select List Default Example Output Source: https://swiftdialog.app/advanced/select-lists Example output when a default value is not specified and the user selects an item. This output is only shown if swiftDialog's exit code is 0. ```bash SelectedOption: Option 1 SelectedIndex: 0 ``` -------------------------------- ### Radio Button Select List Example Source: https://swiftdialog.app/advanced/select-lists Example command to display a select list as radio buttons. When using 'radio' without a default, the first item becomes the default. ```bash --selecttitle "Radio buttons",radio --selectvalues "Option One, Option Two, Option Three" ``` -------------------------------- ### Basic LaunchAgent for Login Window Source: https://swiftdialog.app/operation/login-window This is an example of a basic LaunchAgent configuration to run a script at the login window. Ensure the ProgramArguments points to your script and LimitLoadToSessionType is set to LoginWindow. ```plist OnDemand LaunchOnlyOnce ProgramArguments /path/to/script.sh LimitLoadToSessionType LoginWindow Label com.swiftDialog.example-login-window ``` -------------------------------- ### Multiselect JSON Output Example Source: https://swiftdialog.app/advanced/select-lists Example of the JSON output format for a multiselect list. ```json { "Choose options" : "Option One, Option Three" } ``` -------------------------------- ### JSON Select Items Configuration Source: https://swiftdialog.app/advanced/select-lists Example JSON configuration for multiple select items, including one with a default value. ```json "selectitems" : [ {"title" : "Select 1", "values" : ["one","two","three"]}, {"title" : "Select 2", "values" : ["red","green","blue"], "default" : "red"} ] ``` -------------------------------- ### Create User Input Form Source: https://swiftdialog.app/ This example demonstrates how to create a dialog with text fields for user input, allowing collection of details like name and email. ```shell # User input form dialog --title "User Information" \ --message "Please enter your details:" \ --textfield "Name,prompt=Enter your name" \ --textfield "Email,prompt=Enter your email" \ --button1text "Submit" ``` -------------------------------- ### Multiple Text Fields Example Source: https://swiftdialog.app/advanced/textfields Shows how to define multiple text fields in a single dialog. Ensure sufficient dialog height. ```bash dialog --textfield "First Name" --textfield "Surname" --textfield "Age" --textfield "Favourite Colour" ``` -------------------------------- ### Verify SwiftDialog Installation Source: https://swiftdialog.app/getting-started/installation Run this command in your terminal to check if SwiftDialog is installed and accessible. ```bash dialog --version ``` -------------------------------- ### Equivalent of --style alert Source: https://swiftdialog.app/advanced/window-size This example shows the equivalent command-line arguments for the --style alert preset, demonstrating custom title, icon size, message formatting, alignment, and dimensions. ```bash dialog --title none --iconsize 80 --message "### An Important Message \n\nThis contains important message content\n\nPlease read" --messagealignment centre --buttonstyle centre --centreicon --width 300 --height 300 ``` -------------------------------- ### Initialize and Update Dialog UI Source: https://swiftdialog.app/examples/demo-scripts This script initializes the dialog by setting initial states and then updates it during a simulated software installation process. It demonstrates controlling button states, text, and progress indicators. ```python # give time for Dialog to launch time.sleep(0.5) writeDialogCommands("button1: disable") time.sleep(2) writeDialogCommands("title: Software Installation") writeDialogCommands("button1text: Please Wait") writeDialogCommands("progress: 0") #Process the list for app in app_list: progress = progress + progress_per_step writeDialogCommands("progressText: Installing {}...".format(app[1])) app[0] = "⏳" updateDialogCommands(app_list, 0) ##### This is where you'd perform the install # Pretend install happening print("Right now we would be running this command\n : {}".format(app[2])) time.sleep(1) writeDialogCommands("progress: increment") time.sleep(1) writeDialogCommands("progress: increment") time.sleep(1) writeDialogCommands("progress: increment") time.sleep(1) writeDialogCommands("progress: increment") app[0] = "✅" updateDialogCommands(app_list, progress) writeDialogCommands("progressText: Installing {}...".format(app[1])) time.sleep(1) writeDialogCommands("icon: SF=checkmark.shield.fill,colour1=#27db2d,colour2=#1b911f") writeDialogCommands("progressText: Complete") writeDialogCommands("button1text: Done") writeDialogCommands("button1: enable") ``` -------------------------------- ### Text Field Output Example Source: https://swiftdialog.app/advanced/textfields Demonstrates the standard output format for a single text field, showing the label and user input. ```text Textfield 1 : This is what the user entered ``` -------------------------------- ### Preset 5 Configuration Example Source: https://swiftdialog.app/advanced/inspect/preset5 This JSON configuration defines the structure and content for a self-service portal workflow, including intro steps with text, bullets, and simulated deployment steps with app information. Edit this file to customize your portal. ```json { "highlightColor" : "#007AFF", "introSteps" : [ { "content" : [ { "content" : "This is a two-step starter. Edit config.json to add more steps, change layouts, or customise the content.", "type" : "text" }, { "items" : [ "Step types: intro, deployment, carousel, guide, showcase, bento, processing, portal, outro", "55+ content block types available", "Add branding, forms, compliance checks" ], "type" : "bullets" } ], "continueButtonText" : "Next", "heroImage" : "SF=macbook.gen2", "heroImageSize" : 180, "id" : "welcome", "showBackButton" : false, "stepType" : "intro", "subtitle" : "Your starter Preset 5 workflow (example)", "title" : "Welcome" }, { "continueButtonText" : "Finish", "heroImage" : "SF=arrow.down.app.fill", "id" : "apps", "items" : [ { "displayName" : "Safari", "guiIndex" : 0, "icon" : "/Applications/Safari.app", "id" : "safari", "paths" : [ "/Applications/Safari.app" ] }, { "displayName" : "Calculator", "guiIndex" : 1, "icon" : "/System/Applications/Calculator.app", "id" : "calculator", "paths" : [ "/System/Applications/Calculator.app" ] }, { "displayName" : "TextEdit", "guiIndex" : 2, "icon" : "/System/Applications/TextEdit.app", "id" : "textedit", "paths" : [ "/System/Applications/TextEdit.app" ] } ], "showBackButton" : true, "stepType" : "deployment", "subtitle" : "Simulated deployment step", "title" : "App Installation" } ], "preset" : "5" } ``` -------------------------------- ### App Deployment Configuration (Preset 1) Source: https://swiftdialog.app/advanced/inspect/preset1 This JSON configuration defines the appearance and content for Preset 1, a traditional sidebar layout. It includes highlight color, an icon, a list of applications to install, a message, the preset number, and the title. ```json { "highlightColor" : "#007AFF", "icon" : "SF=arrow.down.app.fill", "items" : [ { "displayName" : "Safari", "icon" : "/Applications/Safari.app", "id" : "safari", "paths" : [ "/Applications/Safari.app" ], "showBundleInfo" : "all" }, { "displayName" : "Calculator", "icon" : "/System/Applications/Calculator.app", "id" : "calculator", "paths" : [ "/System/Applications/Calculator.app" ], "showBundleInfo" : "all" }, { "displayName" : "TextEdit", "icon" : "/System/Applications/TextEdit.app", "id" : "textedit", "paths" : [ "/System/Applications/TextEdit.app" ], "showBundleInfo" : "all" } ], "message" : "Installing applications...(example)", "preset" : "1", "title" : "App Deployment" } ``` -------------------------------- ### Create Dialog CLI Symlink Source: https://swiftdialog.app/operation/dialogcli Creates the `/usr/local/bin/dialog` symlink pointing to the Dialog CLI launcher. This command must be run as root and is typically handled by the swiftDialog installer. ```bash sudo Dialog.app/Contents/MacOS/dialog --link ``` -------------------------------- ### JSON Select Items with Radio Style Source: https://swiftdialog.app/advanced/select-lists Example JSON configuration for a select item styled as radio buttons. ```json "selectitems" : [ {"title" : "Pick One", "values" : ["One","Two","Three"], "style" : "radio"} ] ``` -------------------------------- ### Advanced Checkbox Example with JSON Source: https://swiftdialog.app/advanced/checkboxes Demonstrates various checkbox configurations including checked, disabled, and default states using a JSON object. ```json { "checkbox" : [ {"label" : "Option 1", "checked" : true, "disabled" : true }, {"label" : "Option 2", "checked" : true, "disabled" : false }, {"label" : "Option 3", "checked" : false }, {"label" : "Option 4", "checked" : true, "disabled" : true }, {"label" : "Option 5" }, {"label" : "Option 6", "disabled" : true } ] } ``` -------------------------------- ### Display Progress Indicator Source: https://swiftdialog.app/ Use this command to show a progress indicator dialog, useful for informing users about ongoing processes like software installation. ```shell # Progress indicator dialog --title "Installing Software" \ --message "Please wait while we set things up..." \ --progress 10 \ --progresstext "Starting installation..." ``` -------------------------------- ### Example: Handling a Bad Command Source: https://swiftdialog.app/examples/shell-commands Illustrates the output when an invalid command is provided to `--button1shellaction`. Dialog still exits with code 0, but the shell error is displayed. ```shell .../Dialog.app/Contents/MacOS/Dialog --button1shellaction "bad command here" zsh:1: command not found: bad ``` -------------------------------- ### Acceptable Use Policy Dialog for Login Window Source: https://swiftdialog.app/operation/login-window An example of an Acceptable Use Policy dialog displayed at the login window. It requires user agreement via a checkbox and displays content from a markdown file using the --eula mode. The dialog is configured to blur the screen and run in the login window context. ```bash dialog --message "/path/to/AcceptableUsePolicy.md" --height 50% --width 35% --style centred --icon sf=rectangle.and.pencil.and.ellipsis,colour=accent --title "{COMPANY-NAME} Acceptable Use" --button1disabled --checkbox "I Agree",enableButton1 --quitkey A --eula --blurscreen --loginwindow ``` -------------------------------- ### Callback Script for Validation Source: https://swiftdialog.app/advanced/cards Example script to validate email format before allowing advancement. Exit code 0 permits advancement; non-zero blocks it. ```bash #!/bin/bash # script.sh - Validate email format before advancing input=$(cat) email=$(echo "$input" | jq -r '.["Email Address"]') if [[ ! "$email" =~ ^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}$ ]]; then echo "Invalid email address format" exit 1 fi exit 0 ``` -------------------------------- ### MDM Payload for Notification Settings Source: https://swiftdialog.app/advanced/notifications This example demonstrates an MDM payload for configuring notification settings for multiple Dialog bundle identifiers. It specifies alert types, badge, lock screen, and notification center visibility. ```xml PayloadContent PayloadDisplayName Notifications Payload PayloadIdentifier 449B1259-E631-4051-ADCE-9532B813ADDC PayloadOrganization Org Name PayloadType com.apple.notificationsettings PayloadUUID 12EA8FDA-B204-4AD0-802C-C980615F0BA5 PayloadVersion 1 NotificationSettings AlertType 1 BadgesEnabled BundleIdentifier au.bartreardon.dialog CriticalAlertEnabled NotificationsEnabled ShowInLockScreen ShowInNotificationCenter SoundsEnabled AlertType 1 BadgesEnabled BundleIdentifier au.csiro.dialog CriticalAlertEnabled NotificationsEnabled ShowInLockScreen ShowInNotificationCenter SoundsEnabled AlertType 1 BadgesEnabled BundleIdentifier au.csiro.dialog.banner CriticalAlertEnabled NotificationsEnabled ShowInLockScreen ShowInNotificationCenter SoundsEnabled AlertType 2 BadgesEnabled BundleIdentifier au.csiro.dialog.alert CriticalAlertEnabled NotificationsEnabled ShowInLockScreen ShowInNotificationCenter SoundsEnabled ``` -------------------------------- ### Parse Dialog stdout with Awk Source: https://swiftdialog.app/operation/capturing-output Extract specific output fields from Dialog using awk, particularly useful for parsing selections or text field inputs. The example shows how to get the selected option. ```bash /usr/local/bin/dialog <...> | grep "SelectedOption" | awk -F " : " '{print $NF}' ``` -------------------------------- ### Run Onboarding Wizard with JSON File Source: https://swiftdialog.app/advanced/cards Executes the swiftDialog application using a pre-defined JSON configuration file to display the employee onboarding wizard. ```bash dialog --jsonfile onboarding.json ``` -------------------------------- ### Shell Script for Employee Onboarding Source: https://swiftdialog.app/advanced/cards A complete shell script that generates a swiftDialog JSON configuration dynamically, displays the onboarding wizard, processes the output using `jq`, and includes placeholders for custom logic. ```bash #!/bin/bash # onboarding.sh - Employee onboarding with swiftDialog cards DIALOG="/usr/local/bin/dialog" CONFIG="/tmp/onboarding_config.json" # Create the JSON configuration cat > "$CONFIG" << 'EOF' { "title": "Employee Onboarding", "icon": "SF=person.crop.circle.badge.checkmark", "width": 700, "height": 450, "cards": [ { "title": "Welcome", "message": "Welcome to Company XYZ! This wizard will set up your account." }, { "title": "Enter Details", "message": "Please provide your information:", "textfield": [ { "title": "Full Name", "required": true }, { "title": "Email", "required": true } ] }, { "title": "Complete", "message": "Onboarding complete for {Full Name}!", "infobox": "We'll send a confirmation to {Email}" } ] } EOF # Run dialog and capture output if output=$("$DIALOG" --jsonfile "$CONFIG" 2>&1); then echo "Onboarding completed successfully!" echo "Collected data:" echo "$output" | jq . # Extract specific fields full_name=$(echo "$output" | jq -r '.["Full Name"]') email=$(echo "$output" | jq -r '.Email') echo "Processing onboarding for $full_name ($email)..." # Add your custom logic here # - Create user account # - Send welcome email # - Configure systems else echo "Onboarding was cancelled or failed" exit 1 fi # Cleanup rm -f "$CONFIG" ``` -------------------------------- ### Display Local Video File Source: https://swiftdialog.app/basic-use/video Use the `--video` command followed by the file path to display a local video. The dialog window will resize to accommodate the video. Custom sizes can be set with `--width` and `--height`. ```bash --video /Users/Shared/Videos/day4session3.mp4 ``` -------------------------------- ### Launch swiftDialog with Inspect Mode and Config File Source: https://swiftdialog.app/advanced/inspect-mode Execute swiftDialog with the --inspect-mode flag, specifying the configuration file path. ```bash /usr/local/bin/dialog --inspect-mode --inspect-config /path/to/config.json ``` -------------------------------- ### Uninstall SwiftDialog Source: https://swiftdialog.app/getting-started/installation Remove SwiftDialog from your system by deleting the binary from its installation path. ```bash sudo rm /usr/local/bin/dialog ``` -------------------------------- ### File Select with Initial Path Source: https://swiftdialog.app/advanced/textfields Use `path=` with `fileselect` to set the directory the file picker initially opens to. ```bash --textfield "Log File,fileselect,path=/var/log" ``` -------------------------------- ### Complete Employee Onboarding Wizard JSON Source: https://swiftdialog.app/advanced/cards Defines a multi-card dialog for employee onboarding, including personal information, department selection, system preferences, and a review step with variable substitution. ```json { "title": "Employee Onboarding", "icon": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/UserIcon.icns", "width": 750, "height": 500, "button1text": "Continue", "cards": [ { "title": "Welcome to the Company!", "message": "## Welcome Aboard!\n\nThis wizard will guide you through the onboarding process.\n\nClick Continue to get started.", "icon": "SF=hands.clap.fill", "iconsize": 120 }, { "title": "Personal Information", "message": "Please provide your personal details (all fields required):", "textfield": [ { "title": "First Name", "required": true }, { "title": "Last Name", "required": true }, { "title": "Employee ID", "required": true }, { "title": "Work Email", "required": true, "prompt": "name@company.com" } ] }, { "title": "Department Assignment", "message": "Select your department and role:", "selectitems": [ { "title": "Department", "values": ["Engineering", "Marketing", "Sales", "HR", "Finance"], "default": "Engineering" }, { "title": "Role", "values": ["Manager", "Senior", "Mid-level", "Junior"], "default": "Mid-level" } ] }, { "title": "System Preferences", "message": "Configure your system preferences:", "checkbox": [ { "label": "Enable email notifications", "checked": true }, { "label": "Join company Slack", "checked": true }, { "label": "Subscribe to company newsletter", "checked": true }, { "label": "Opt-in to mentorship program", "checked": false } ] }, { "title": "Review & Confirm", "message": "Please review your information before completing the onboarding process:", "icon": "SF=checkmark.circle", "infobox": "**Name:** {First Name} {Last Name}\n**Employee ID:** {Employee ID}\n**Email:** {Work Email}\n\n**Department:** {Department}\n**Role:** {Role}\n\n**Email Notifications:** {Enable email notifications}\n**Slack:** {Join company Slack}\n**Newsletter:** {Subscribe to company newsletter}\n**Mentorship:** {Opt-in to mentorship program}", "button1text": "Complete Onboarding" } ] } ``` -------------------------------- ### Checkbox Output (JSON) Source: https://swiftdialog.app/advanced/checkboxes Get checkbox results in JSON format by specifying the `--json` parameter. This provides a structured output of selected options. ```json { "Option 2" : true, "Option 4" : true, "Option 5" : false, "Option 6" : true, "Option 1" : true, "Option 3" : false } ``` -------------------------------- ### Accept Multiple Image/Icon Files Source: https://swiftdialog.app/reference/releasenotes/sd3-0-0 The `--image` and `--icon` arguments can now accept a comma-separated list of file paths for multiple images or icons. ```bash dialog --image "/path/image1.png","/path/image2.png","/path/image3.png" ``` -------------------------------- ### Check Dialog Bundle Identifiers Source: https://swiftdialog.app/advanced/notifications Use these commands to verify the bundle identifiers for Dialog helper applications on your system. This is useful for confirming installed versions and their associated identifiers. ```shell defaults read "/Library/Application Support/Dialog/Dialog.app/Contents/Helpers/Dialog Banner.app/Contents/Info.plist" CFBundleIdentifier ``` ```shell defaults read "/Library/Application Support/Dialog/Dialog.app/Contents/Helpers/Dialog Alert.app/Contents/Info.plist" CFBundleIdentifier ``` -------------------------------- ### Play Sound on Launch Source: https://swiftdialog.app/reference/releasenotes/sd3-0-0 Use the `--sound` argument to play an audio file or URL when the dialog is launched. Add `--showsoundcontrols` for long audio files. ```bash dialog --sound /System/Library/Sounds/Glass.aiff ``` -------------------------------- ### Customize Button 1 Text Source: https://swiftdialog.app/basic-use/buttons Modify the label of the default 'OK' button using the --button1text option. This allows for custom text to guide user interaction. ```bash --button1text "Enter to Continue" ``` -------------------------------- ### Simple Three-Step Wizard Configuration Source: https://swiftdialog.app/advanced/cards A complete JSON configuration for a three-step wizard, including titles, messages, input fields with validation, and custom button text. ```json { "title": "Setup Wizard", "icon": "SF=gearshape.2", "button1text": "Continue", "cards": [ { "title": "Welcome", "message": "Welcome to the setup wizard. Click Continue to begin." }, { "title": "Enter Information", "message": "Please provide your details:", "textfield": [ { "title": "Full Name", "required": true }, { "title": "Email Address", "required": true } ] }, { "title": "Complete", "message": "Setup is complete! Click Finish to close this wizard.", "button1text": "Finish" } ] } ``` -------------------------------- ### Select List with Alternate Name Output Source: https://swiftdialog.app/advanced/select-lists Example of using the 'name' modifier to specify an alternate output name for a select list. Includes standard and alternate name output formats. ```bash % dialog --selecttitle "Alternate Name",name=alt --selectvalues "Option One, Option Two, Option Three" "SelectedOption" : "Option One" "SelectedIndex" : 0 "alt" : "Option One" "alt" index : "0" ``` -------------------------------- ### Load Info Box from File Source: https://swiftdialog.app/advanced/command-file Load the info box content from a specified Markdown file. ```bash echo "infobox: /path/to/infobox.md" >> /var/tmp/dialog.log ``` -------------------------------- ### Configure Cache Monitoring for Downloads Source: https://swiftdialog.app/advanced/inspect-mode Specify directories to monitor for download progress and set the scan interval in seconds. The system detects .pkg, .dmg, and .download files matching item IDs. ```json { "cachePaths": [ "/Library/Managed Installs/Cache", "/Library/Application Support/Installomator/Downloads", "/Library/Application Support/JAMF/Downloads", "/Library/Application Support/AirWatch/Data/Munki/Managed Installs/Cache" ], "scanInterval": 5 } ``` -------------------------------- ### Test SwiftDialog Dialog Source: https://swiftdialog.app/getting-started/installation Use this command to display a simple test dialog, confirming SwiftDialog's functionality. ```bash dialog --title "Test" --message "swiftDialog is installed!" ``` -------------------------------- ### Set Info Button Action to Open URL Source: https://swiftdialog.app/basic-use/buttons Configure the 'More Information' button to perform an action, such as opening a URL, using the --infobuttonaction option. The --quitoninfo flag can restore default exit behavior. ```bash --infobuttonaction "https://github.com/" ``` -------------------------------- ### Customize Title Font Properties Source: https://swiftdialog.app/basic-use/title Use the `--titlefont` option with `property=value` pairs, separated by commas, to customize font properties like color, size, weight, name, alignment, and offset. For example, to modify only the size, use `size=`. ```bash --titlefont "size=60" ``` ```bash --titlefont "colour=#00A4C7,weight=light,size=60" ``` ```bash --titlefont "name=Chalkboard-Bold,colour=#D054A0,size=40" ``` ```bash --titlefont alignment=left ``` ```bash --titlefont alignment=right ``` -------------------------------- ### Clear and Update Dialog with New Web Content Source: https://swiftdialog.app/basic-use/video To switch to a new website, first clear the existing content by echoing `webcontent: none` to `/var/tmp/dialog.log`, then echo the new URL. These commands can be chained. ```bash echo "webcontent: none" >> /var/tmp/dialog.log echo "webcontent: https://some.new.website.com" >> /var/tmp/dialog.log ``` ```bash echo "webcontent: none" >> /var/tmp/dialog.log && echo "webcontent: https://some.new.website.com" >> /var/tmp/dialog.log ``` -------------------------------- ### App Catalog Configuration Source: https://swiftdialog.app/advanced/inspect/preset2 This JSON configuration defines the 'App Catalog' preset, including highlight color, icon, and a list of application items with their display names, icons, IDs, paths, and bundle info visibility. ```json { "highlightColor" : "#34C759", "icon" : "SF=rectangle.split.3x1.fill", "items" : [ { "displayName" : "Safari", "icon" : "/Applications/Safari.app", "id" : "safari", "paths" : [ "/Applications/Safari.app" ], "showBundleInfo" : "all" }, { "displayName" : "Calculator", "icon" : "/System/Applications/Calculator.app", "id" : "calculator", "paths" : [ "/System/Applications/Calculator.app" ], "showBundleInfo" : "all" }, { "displayName" : "TextEdit", "icon" : "/System/Applications/TextEdit.app", "id" : "textedit", "paths" : [ "/System/Applications/TextEdit.app" ], "showBundleInfo" : "all" } ], "message" : "Installing applications...(example)", "preset" : "2", "title" : "App Catalog" } ``` -------------------------------- ### Modify Message Font, Color, and Size Source: https://swiftdialog.app/basic-use/message The --messagefont option allows customization of the message's font, text size, and color. Colors can be specified by name or hex code, and size accepts float values. Font name accepts any installed font. ```bash --messagefont "name=Chalkboard-Bold,colour=#D054A0,size=40" ``` -------------------------------- ### Display Image from File or URL Source: https://swiftdialog.app/basic-use/images Use the --image flag to display an image from a local file or a URL. Images are resized to fit the display area. The --imagecaption flag can be used for a description. ```bash -g, --image | Display an image instead of a message. Images will be resized to fit the available display area --imagecaption Text that will appear underneath the displayed image. ``` -------------------------------- ### Run swiftDialog with JSON Configuration Source: https://swiftdialog.app/advanced/cards Command to execute a swiftDialog with a JSON configuration file. Ensure the path to your configuration file is correct. ```bash dialog --jsonfile /path/to/config.json ``` -------------------------------- ### Basic Dialog Configuration Source: https://swiftdialog.app/advanced/command-line-options Sets the title and message for a simple dialog. Use `--help