β12-15-2021 07:35 PM - edited β02-16-2022 05:52 PM
I posted this in the macadmin Slack & kind of forgot to post it here...
Just a 1st crack at it, but, I put this in Self Service so users can run the networkQuality tests.
You may need to set AppleScript PPPC exceptions but these osascript commands for the most part on recent versions of macOS should be fine without them. Enjoy!
P.S. macOS Monterey only as far as I know... Sorry.
#!/bin/zsh
filpth='/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources'
tsttyp=$(/usr/bin/osascript -e "choose from list {\"Download + Upload Speed\", \"Video Conferencing\"} with title \"Network Quality Test\" with prompt \"Please select test type to begin:\"")
case "$tsttyp" in
'false' ) exit ;;
'Download + Upload Speed' ) icnsnm='GenericNetworkIcon'
option='-sv' ;;
'Video Conferencing' ) icnsnm='GroupIcon'
option='-v' ;;
esac
/usr/bin/osascript -e "display dialog \"Test in progress...\n\" buttons {\"Cancel\"} with icon POSIX file \"$filpth/$icnsnm.icns\" with Title \"Network Quality Test - $tsttyp\"" &
prgpid=$!
/usr/bin/networkquality "$option" | /usr/bin/sed '/SUMMARY/d' > /private/tmp/summary.txt &
while true
do
if [ -n "$(/bin/cat /private/tmp/summary.txt)" ]
then
break
fi
if /bin/kill -s 0 "$prgpid"
then
>&2 echo "waiting for networkquality..."
/bin/sleep 3
else
exit
fi
done
>&2 echo "$(/bin/cat /private/tmp/summary.txt)"
/usr/bin/osascript -e "display dialog \"$(/bin/cat /private/tmp/summary.txt)\" buttons {\"Ok\"} default button 1 with icon POSIX file \"$filpth/$icnsnm.icns\" with Title \"Network Quality Test - $tsttyp\""
/bin/rm -rf /private/tmp/summary.txt
/bin/kill -9 "$prgpid"
Posted on β12-17-2021 03:44 AM
This looks very cool! I tried running it in Terminal and got the Test in Progress window, but Terminal just said
no such file or directory: /usr/bin/networkquality
Sure enough, that file does not exist. Where can one obtain said file?
Posted on β12-17-2021 09:02 AM
aaahhhhh.... it's only in Monterey. I ran it on my Monterey Mac and it does look very handy..
Posted on β12-17-2021 03:08 PM
Yes. I kind of failed to mention that. π Sorry!
Posted on β06-02-2022 09:45 AM
This is excellent, thank you!
β08-26-2022 11:11 AM - edited β08-26-2022 11:13 AM
Guessing it no likey proxy servers. #sigh
+1 Kudo, since I know if @brockwalters wrote it, it works. :)