Applescript app to shut down Mathematica at a specific time of day
Here's why it doesn't work.

HIDIdleTime is the number of seconds of inactivity, so unless the user do absolutely nothing during fifteen minutes, your script doesn't work.

Here's how to do this in AppleScript.

set timeToQuit to 50700 -- time in seconds =14h05
set currDate to current date

-- do nothing on Saturday and Sunday or this script is launched after 14h05
if weekday of currDate is in {Saturday, Sunday} or (time of currDate) &gt; timeToQuit then return

delay (timeToQuit - (time of currDate)) -- wait 
tell application "System Events" to exists process "Mathematica"
if the result then quit application "Mathematica"