I’m trying to do a script that will close an app at a certain time of day. I did the recording of “close the app” but i don’t know the language to say “do it at 04:00am”. i don’t even care if its a recurring thing, i’m ok w/ just opening the script and letting it sit there til the time comes and then it closes the app. all i want is for it to stop the app at such-and-such a time…i know this is probably a basic code, but i’m having trouble finding info…
I haven’t tested this but the code below could be saved as a stay open app. It should check to see what time it is and if it is between midnight (0 hour) and 4 PM (16 hour) nothing will happen. If it is 4 PM to midnight and the application is open, it will try to quit it. It checks every 10 minutes (it could check more or less often using the idle return). Unless you start this at an even multiple of the 10 minute mark of an hour (say 3:40), then the app will be off by up to 9 minutes if you started at 3:49. If you set the return to be more frequent, you could notice some performance issues on the rest of the machine but you’ll get closer to quitting at 4 regardless of when the script was started.