home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
Support
other features (of release or svn versions)
What's the best way to auto off?
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="phe" data-source="post: 213340" data-attributes="member: 56939"><p>Hi rsbrux,</p><p></p><p>I'm in a similar situation: 2 windows accounts, 1 for MP, 1 for work/maintenance via remote desktop connection from laptop; Hibernation via PowerScheduler/Homescreen.</p><p></p><p>At the moment, to avoid hibernation during work, I manually set MP to a screen other than home.</p><p></p><p>Of course this sucks, so I'm planning to modify PowerScheduler not to trigger hibernation as long as an other user is logged in.</p><p></p><p>In order to logoff the second (work) account automatically (in case I forget doing so), i've put together a batch file and set the batch to run after an idle period of x minutes (Windows Task Scheduler).</p><p></p><p>But because this would kill any background software as well, the batch file checks whether any given process (like a download manager) is running, and if so, it doesn't logoff the user.</p><p></p><p>The weakest point in this, is how to figure out when your background software preventing auto-logoff has finished its work. In my case it's pretty easy as I only use FlashGet which can be told to exit when all downloads are completed.</p><p></p><p></p><p>Maybe this is useful in some way.</p><p>regards,</p><p>phe</p><p></p><p></p><p></p><p>Batchfile follows:</p><p></p><p>[CODE]</p><p>:: ********************************************************</p><p>:: SafeLogout - Logout current user when countdown reached</p><p>:: and none of the defined processes is active</p><p>:: ********************************************************</p><p></p><p>@echo off</p><p></p><p>:: OPTIONS ************************************************</p><p></p><p> :: list of processes that prevent the logout (.exe-name)</p><p>SET PROC01=flashget.exe</p><p>rem SET YOUR_PROCESS=whatever.exe</p><p></p><p> :: duration of countdown before logout (seconds)</p><p>SET TIMEOUT=10</p><p></p><p> :: option to force logout (usually not needed, loss of unsaved data!)</p><p>rem SET FORCE=-f</p><p></p><p>:: ********************************************************</p><p></p><p></p><p>:: START **************************************************</p><p></p><p>SET COUNTDOWN=%TIMEOUT%</p><p></p><p></p><p>:: Search process list if any of the "magic" processes is active...</p><p>tasklist /FI "IMAGENAME eq %PROC01%" | find /I /C "%PROC01%" </p><p>rem tasklist /FI "IMAGENAME eq %YOUR_PROCESS" | find /I /C "YOUR_PROCESS"</p><p></p><p>cls</p><p></p><p>:: if so, leave everything as it is</p><p>if %ERRORLEVEL% LEQ 0 exit </p><p></p><p></p><p>:: otherwise start countdown to logout</p><p>echo Logout in %TIMEOUT% seconds... ### Cancel: CTRL+C + yes (or click "x")###</p><p></p><p></p><p>:: loop to show time left before logout</p><p>SET LOOP=0</p><p></p><p>:LOOP_START</p><p> SET /A LOOP=%LOOP%+1</p><p></p><p> echo %COUNTDOWN%</p><p> SET /A COUNTDOWN=%COUNTDOWN%-1</p><p></p><p> sleep 1</p><p> if NOT %errorlevel%==0 ping -w 1000 fake.timeout > nul</p><p> </p><p>if %LOOP%==%TIMEOUT% GOTO LOOP_BREAK</p><p>GOTO LOOP_START</p><p></p><p>:LOOP_BREAK</p><p></p><p></p><p>:: logout current user now!</p><p>shutdown -l %FORCE% -t 00</p><p></p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="phe, post: 213340, member: 56939"] Hi rsbrux, I'm in a similar situation: 2 windows accounts, 1 for MP, 1 for work/maintenance via remote desktop connection from laptop; Hibernation via PowerScheduler/Homescreen. At the moment, to avoid hibernation during work, I manually set MP to a screen other than home. Of course this sucks, so I'm planning to modify PowerScheduler not to trigger hibernation as long as an other user is logged in. In order to logoff the second (work) account automatically (in case I forget doing so), i've put together a batch file and set the batch to run after an idle period of x minutes (Windows Task Scheduler). But because this would kill any background software as well, the batch file checks whether any given process (like a download manager) is running, and if so, it doesn't logoff the user. The weakest point in this, is how to figure out when your background software preventing auto-logoff has finished its work. In my case it's pretty easy as I only use FlashGet which can be told to exit when all downloads are completed. Maybe this is useful in some way. regards, phe Batchfile follows: [CODE] :: ******************************************************** :: SafeLogout - Logout current user when countdown reached :: and none of the defined processes is active :: ******************************************************** @echo off :: OPTIONS ************************************************ :: list of processes that prevent the logout (.exe-name) SET PROC01=flashget.exe rem SET YOUR_PROCESS=whatever.exe :: duration of countdown before logout (seconds) SET TIMEOUT=10 :: option to force logout (usually not needed, loss of unsaved data!) rem SET FORCE=-f :: ******************************************************** :: START ************************************************** SET COUNTDOWN=%TIMEOUT% :: Search process list if any of the "magic" processes is active... tasklist /FI "IMAGENAME eq %PROC01%" | find /I /C "%PROC01%" rem tasklist /FI "IMAGENAME eq %YOUR_PROCESS" | find /I /C "YOUR_PROCESS" cls :: if so, leave everything as it is if %ERRORLEVEL% LEQ 0 exit :: otherwise start countdown to logout echo Logout in %TIMEOUT% seconds... ### Cancel: CTRL+C + yes (or click "x")### :: loop to show time left before logout SET LOOP=0 :LOOP_START SET /A LOOP=%LOOP%+1 echo %COUNTDOWN% SET /A COUNTDOWN=%COUNTDOWN%-1 sleep 1 if NOT %errorlevel%==0 ping -w 1000 fake.timeout > nul if %LOOP%==%TIMEOUT% GOTO LOOP_BREAK GOTO LOOP_START :LOOP_BREAK :: logout current user now! shutdown -l %FORCE% -t 00 [/CODE] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
Support
other features (of release or svn versions)
What's the best way to auto off?
Contact us
RSS
Top
Bottom