r/applescript • • Mar 04 '23

Help! Progressbar doesn't show while called from shell.

I'm fiddling with applescript that makes a progressbar.

set progress description to "A simple progress indicator"
set progress additional description to "Preparing…"
set progress total steps to -1

delay 0.1

set progress total steps to 30
repeat with i from 1 to 30
	try
		set progress additional description to "I am on step " & i
		set progress completed steps to i
		delay 0.1
	on error thisErr
		display alert thisErr
		exit repeat
	end try
end repeat
-- Taken and edited from https://developer.apple.com/library/archive/documentation/LanguagesUtilities/Conceptual/MacAutomationScriptingGuide/DisplayProgress.html

While run in the script editor, I can see the progress icon running. However, when I call the script with shell osascript ~/the_script.scpt, it only hangs for 3 seconds and exits without showing any progressbar. Additionally, I do need to run it from shell, because at the end I hope other types off applications (e.g. emacs) can call a progressbar too.

How do I fix this issue?

1 Upvotes

6 comments sorted by

View all comments

Show parent comment

1

u/stuudente Mar 04 '23

Thank you! I have used the script editor to export my script to an app and run as you said. It worked!

If exporting to an app is necessary, then I must find out a way to export a script to an app from the shell. Do you happen to know how I can do that?

EDIT Nevermind, I found it. It is osacompile -o out.app in.scpt. Thanks again!