I’ll start with what I am trying to do and why. I have a number of Macs that are “public” systems. The policy where I am located is that the systems be set to “Require password after sleep or screen saver begins”. The problem is that, as you might expect, a user logs in to the system, performs their task and walks away. 15 minutes later, the screen saver kicks in and the screen locks and the next user can not get on the system. The simple solution to set the system to “Log out after “15” minutes of inactivity” does not work because one of the applications that is usually opened by the users is Citrix; Which cancels the log out because it wants confirmation of the disconnection.
So, what I am trying to do is come up with a script and/or Automator app that will run after 15 minutes of inactivity. It is a simple matter to write an Automator workflow that will “Quit All Applications” (with Ask to save changes Unchecked - Which still won’t overcome the “Confirm Disconnect” dialog box in Citrix) and then “Run AppleScript” with the following script:
tell application “System Events”
restart
end tell
Sidebar question about this simple script: I tried the script like this:
tell application “System Events”
force restart
end tell
And although it compiles without any errors, when I tried to run it I get the following error:
error “The variable force is not defined.” number -2753 from “force”
So, is there a different “Force Restart” command I could tell System Events to run?
And then on to what seems to be the biggest obstacle. Provided that I have a proper Automator app written that will quit all running apps AND force the system to restart (or alternately force the system to Log Out of the current user), how can I tell the system to launch that app after 15 minutes of inactivity?
I have also looked in to the possibility of using this command in Terminal:
reboot -q
and save it as an executable shell script (but I can not seem to figure out how to MAKE an executable shell script) and then using the screensaver that other folks have mentioned called ScriptSaver. If I could get the right script to force a reboot, would that work?
Any help would be very much appreciated.
thanks