r/applescript • u/stuudente • 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.htmlWhile 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
View all comments
Show parent comment
1
u/porkchop_d_clown Mar 04 '23
The syntax for the "tell" command is:
But don't bother, I just tried it and it doesn't work. I googled around and while I've found other people with the same complaint you have. I don't see an answer, it may simply not be supported by osascript.
However, I tried this and it works, although it's not what you want. You might be able to adapt it to your needs:
I do not recommend displaying 30 notifications at .1 second intervals, though. ;-)