Created
April 12, 2021 19:04
-
-
Save boberito/d89ea248de6713bd84ed76217549693c to your computer and use it in GitHub Desktop.
Applescript Progress bar from Curl output redirect
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
osacompile -x -o test.app<<EOF | |
set progress description to "Download progress indicator" | |
set progress additional description to "Preparing…" | |
set progress total steps to -1 | |
delay 5 | |
set i to 0 | |
set progress total steps to 100 | |
repeat until i = 100 | |
try | |
set i to (do shell script "grep -p '.*[0-9].*' /Library/Logs/curlout.stderr | tr -u '\\r' '\\n' | tail -1 | awk '{print \$1}'") | |
set progress additional description to "Download is " & i & "% complete" | |
set progress completed steps to i | |
delay 1 | |
on error thisErr | |
display alert thisErr | |
exit repeat | |
end try | |
end repeat | |
EOF | |
sleep 3 | |
open test.app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment