PDA

View Full Version : Auto Logoff Script


Reavern
2006-08-12, 11:52
I just wanted to know if it was possible to add a script that automaticaly runs when I logon to my profile and when it leave the xbox alone for 10 minutes that it goes back to the login screen. Is this possible at all?

spiff
2006-08-12, 14:16
yes

Nuka1195
2006-08-12, 19:25
- 12-08-2006 added: xbmc.getGlobalIdleTime() method to python. Updated some documentation.

You can use this method to check the idle time. I guess that was obvious. :)

Reavern
2006-08-13, 09:58
I have tried looking around but I don't know what function to use to get it to go back to the login screen.

spiff
2006-08-13, 10:56
the builtin command

system.logoff

Nuka1195
2006-08-13, 17:22
# idle time in minutes
IDLE_TIME_MIN = 10
s = 1
while s > 0:
# get idle time
it = xbmc.getGlobalIdleTime()
#calculate sleep time in msec
s = ((IDLE_TIME_MIN * 60) - it ) * 1000
# sleep
if (s > 0): xbmc.sleep(s)
# log off
xbmc.executebuiltin('System.LogOff')

either name it autoexec.py or call it from autoexec.py