Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Very Basic Question

Options
  • 20-05-2005 6:34am
    #1
    Registered Users Posts: 626 ✭✭✭


    Hi,

    I am very new to programming of any kind, but I want to write a batch file in Windows XP that will run a command if the keyboard or mouse is inactive for > say 5 minutes.

    Basically, I've got a PVR setup with gbpvr . It will wake the machine from hibernation to do a scheduled task, ie a recording, but will not automatically put it back into hibernation. It will run a batch file after each recording, and I have a way of putting it into hibernation with nircmd . I just need a way of saying "if mouse inactive for >5 mins, run the nircmd hibernate" in DOS. That way it will not hibernate unless the machine is not in use.

    Thanks,

    Ro


Comments

  • Registered Users Posts: 21,264 ✭✭✭✭Hobbes


    About the only way offhand I can see to do this is to create a custom screensaver that calls those commands and set it for 5 minutes. You just need some kind of file which acts as a flag to tell the screensaver its doing work and not just being idle for the sake of it.


  • Moderators, Recreation & Hobbies Moderators, Science, Health & Environment Moderators, Technology & Internet Moderators Posts: 91,690 Mod ✭✭✭✭Capt'n Midnight


    Does the task scheduler / scheduled tasks (I hate name changes) count IDLE as no user movement or no app running ?

    Might be possible to use it to do shutdown - only if computer has been idle for X amount of time .

    Maybe have two batch files - one does nothing, the other shuts down the PC
    so when finished recording COPY SHUTD.BAT RUN-NOW.BAT

    RUN-NOW is scheduled to run every 10 minutes or whatever,

    All other times like on startup or whatever you
    COPY NOTHING.BAT RUN-NOW.BAT - so NOTHING will happen every 10 minutes.


  • Registered Users Posts: 2,426 ✭✭✭ressem


    There are other methods available, but not sure about what you'd be willing to use?
    Also require some level of programming practice to get right.

    Are the target platforms Win 2000, XP or 2003?
    In which the API call
    GetLastInputInfo() is recommended
    http://www.developer.com/net/cplus/article.php/10919_3416271_1

    Also/alternatively
    There is keyboard/mouse trapping
    http://www.microsoft.com/msj/0200/c/c0200.aspx


Advertisement