Hi, I am a complete beginner in AppleScript programming and have been using Apple devices for only a year. However, I have some experience with PowerShell and earlier with VB programming. For me, I solved the problem by writing an AppleScript that writes the playtime of the current day and week into the Apple menu on the desktop so that my son can always keep track of his times even in maximized mode. When the weekly time limit is reached, everything related to Minecraft is ruthlessly shut down! This is completely independent of the Java version but, of course, not configurable via "Apple Screen Time." The script runs as "root" and should not be manipulable. I've spent about 30 hours on it so far, as I am a total beginner and had to search the internet for even the most basic methods, syntax, etc. I don't plan to maintain or adapt it for others, but if someone has rudimentary knowledge of AppleScript, I'm happy to share it – just let me know! Just a brief overview from the central check:
„…
tell application "System Events"
set _proc to first process whose frontmost is true
end tell
tell _proc
set _res to displayed name
set _prop to properties as list
end tell
if _res = "java" then
repeat with i from 1 to count _prop
set _aItem to item i of _prop as list
set _aItem to _aItem as string
if _aItem contains “minecraft” then
set _res to _aItem
exit repeat
end if
end repeat
end if
**
if _res contains “minecraft” then
…“
Hi jkilcline (John),
I added the script here (mc.scpt) https://drive.google.com/file/d/1OXk-nwTKWpbGFRyB0PU9Pd9LCX26LCze/view?usp=drive_link.
I'am not a programmer and I'am sure he would do it much more better, but I'am happy that I could make it myself working!
It is of course necessary to change all paths!
It is also important to configure the roots crontab and to set the rights!
I added also a bash-script to restart the program if it has stopped working.
Here the additional Infos:
Rights:
-rwxr-xr-x 1 jhopgei staff 107 Jan 13 10:13 mc.bash
-rwxrwxr-x@ 1 jhopgei staff 41646 Jan 15 12:12 mc.scpt
Bash-script (mc.bash):
#!/usr/bin/env bash
if ! (pgrep -f mc.scp)
then
osascript /Users/jhopgei/mc.scpt
fi
Crontab (root!):
@reboot sleep 30 && osascript /Users/jhopgei/mc.scpt
* * * * * /Users/jhopgei/mc.bash
Here how it looks like:
You can configure "View > Always Show Toolbar in Full Screen" if you want.
Cheers,
Jürgen