Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Shut down XP after XX Minutes of inactivity

If you have a question or need help, this is the place to be.
Post Reply
damdy-cash
Experienced User
Posts: 102
Joined: Tue Mar 28, 2006 6:48 am

Shut down XP after XX Minutes of inactivity

Post by damdy-cash »

Hi all,
I've search EG and the whole forum but couldn't find a solution for my problem.
Sometimes I simply forget to switch off my HTPC after watching something served by shared folders provided by my HTPC.
To avoid unwanted energy consumption, I would like to shot down my HTPC after XX minutes of inactivity.

Actual I think I only need to find the right trigger but can't figure out the trick.
Anyone there who could guide me through it please?

Cheers Volker
Gruß Damdy
themaster1
Experienced User
Posts: 133
Joined: Wed Feb 03, 2010 9:02 pm

Re: Shut down XP after XX Minutes of inactivity

Post by themaster1 »

Perhaps you can do that with the event System.idle

The idea would be to start a countdown in seconds whenever the event System.idle is kicking in. What you think?
- system idle event
- python script (probably) to countdown in seconds
- power off computer
damdy-cash
Experienced User
Posts: 102
Joined: Tue Mar 28, 2006 6:48 am

Re: Shut down XP after XX Minutes of inactivity

Post by damdy-cash »

yes of course, I've tried it this way, I'm just struggling to restart the timer as soon something happens after it has started to count dowm the time

Cheers Volker
Gruß Damdy
scissors
Posts: 21
Joined: Mon Oct 17, 2011 1:41 pm

Re: Shut down XP after XX Minutes of inactivity

Post by scissors »

Maybe something like the following...

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1544">
    <Folder Name="Test" Expanded="True">
        <Macro Name="Idle" Expanded="True">
            <Event Name="System.Idle" />
            <Action>
                EventGhost.PythonCommand(u'eg.globals.shutTask = eg.scheduler.AddTask(3600, eg.TriggerEvent, "SHUTDOWN")')
            </Action>
        </Macro>
        <Macro Name="UnIdle" Expanded="True">
            <Event Name="System.UnIdle" />
            <Action>
                EventGhost.PythonCommand(u'eg.scheduler.CancelTask(eg.globals.shutTask)')
            </Action>
        </Macro>
        <Macro Name="Shutdown" Expanded="True">
            <Event Name="SHUTDOWN" />
            <Action>
                EventGhost.ShowOSD(u'Shutdown!', u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial', (255, 255, 255), (0, 0, 0), 0, (0, 0), 0, 3.0, False)
            </Action>
        </Macro>
    </Folder>
</EventGhost>
3600 = seconds

In this example, you'll get an error message in CancelTask when UnIdle is triggered after SHUTDOWN is triggered since shutTask will no longer be valid. You can add checks, but if you're actually shutting down, then I guess it won't matter.
damdy-cash
Experienced User
Posts: 102
Joined: Tue Mar 28, 2006 6:48 am

Re: Shut down XP after XX Minutes of inactivity

Post by damdy-cash »

that looks very promising! Thanks for that!

Cheers Volker
Gruß Damdy
damdy-cash
Experienced User
Posts: 102
Joined: Tue Mar 28, 2006 6:48 am

Re: Shut down XP after XX Minutes of inactivity

Post by damdy-cash »

works like a charm! You made my day

cheers Volker
Gruß Damdy
Post Reply