Send escape to Powerpoint if idle in presentation mode for too long

Problem to solve

Students set powerpoint to presentation mode when they go to lunch etc leaving the computer unlocked and the screen saver wont start (I don't know why, because we allow them to lock the screen for 75 minutes before they get logged off.)

Not only is this a violation of the University computer agreement, they also open for others to use their account to browse the Internet or to copy/delete the files etc. In short, we need to fix this.

What we need to do is to check if the computer is idle for real (not the same as the screen saver looks for) and then let the powerpoint presentation run for 10 minutes at idle before we send escape to exit presentation mode. If they run the presentation for real, they will most likely send new key/mouse presses when they change slide and idletime resets.

To begin with we tried to use a powershell script made by my collegue Lillian.
We tried at least 5 different ways to run the script as a scheduled task, but it would never press escape in powerpoint. (if you make this work please let me know!)
The scheduled job used cscript to run a vbs-script that runs powershell that runs the powershell script. VBS script is used to make the powershell window invisible.
Then I made a very simple "send escape" EXE-compiled AutoIt script as scheduled task and it worked, next step was to convert the powershell code into AutoIt.

The script

If you want another allowed idle time, hust change the number "10" on the line including this:($iIdleTime/1000/60 > 10)

==== Script begins ====

#cs ----------------------------------------------------------------------------

 AutoIt Version:
 Author:         Lilian Zachrisson

 Script Function:
Closes PowerPoint presenteation if idle time 10 min or above.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <MsgBoxConstants.au3>
#include <Timers.au3>

Local $iIdleTime = _Timer_GetIdleTime()

If ProcessExists("POWERPNT.EXE") And ($iIdleTime/1000/60 > 10) Then ; Check if the Powerpoint process is running.
$aWindows = WinList("[REGEXPTITLE:(?i)(PowerPoint Slide show.*)]")
For $i=1 To $aWindows[0][0]
; Close the Powerpoint window using the handle returned by WinWait.
MsgBox($MB_SYSTEMMODAL, "", "Powerpoint presentation was closed do to inactivity")

==== Script ends begins ====

How it runs

The script is compiled into an EXE-file with the Aut2exe.exe tool and is copied to the local computers by a GPO. (in the Computer part of GPO)
The same GPO create a scheduled task that runs every 5 minutes as the logged on user (in the USER part of GPO).

Problems encountered

Heads up! There is a bug(?) in the task scheduler that make repeating jobs halt if you run them manually (like when you spend the entire day testing stuff).
The solution for me was to disable the "allow task to run on demand" option and use two triggers. One that is on a time schedule and repeating every 5 minutes. The other is triggered on user logon and repeats every 5 minutes. Maybe Ill try to remove one of them later on (I'll update my text then).