How to display a progress bar in an AppleScript Xcode application.

I’ve been using the built-in Applescript progress bar script as outlined here:

https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/DisplayProgress.html

and it works great unless I try to use it in an Xcode AppleScript app. Do I need to add a permission or library or something to get it to work in Xcode?

To clarify, this script works great as an app made from Script Editor, but it doesn’t work if you add the code to an Xcode Applescript application:

set theImages to 5

-- Update the initial progress information
set theImageCount to 5
set progress total steps to theImageCount
set progress completed steps to 0
set progress description to "Processing Items..."
set progress additional description to "Preparing to process."

repeat with a from 1 to theImageCount
	-- Update the progress detail
	set progress additional description to "Processing item " & a & " of " & theImageCount
	
	-- Increment the progress
	set progress completed steps to a
	
	-- Pause for demonstration purposes, so progress can be seen
	delay 1
end repeat

-- Reset the progress information
set progress total steps to 0
set progress completed steps to 0
set progress description to ""
set progress additional description to ""

You have to build your own dialog in an Xcode project.

Interesting! Is there another option to be able to do a communicate progress via some sort of AppleScript dialog that a newb like me would be able to handle? :slight_smile: