Power Off/Standby - Start batch file (1 Viewer)

chrisonline

MP Donator
  • Premium Supporter
  • August 17, 2007
    515
    37
    44
    Tirol/Wörgl
    Home Country
    Austria Austria
    Thanks I have tried this tool.
    All tools have the same problem. If the system goes to standby it will call the batch file, BUT the system does not wait until the batch file is completed. :-(
    --- Post updated ---
    I think the only solution is that the batch file will send the PC to standby, BUT this can only be done if I can override the Harmony "Power Off" command to a other command.
    And it seems this is not possible.
     

    CyberSimian

    Test Group
  • Team MediaPortal
  • June 10, 2013
    2,875
    1,804
    Southampton
    Home Country
    United Kingdom United Kingdom
    I think the only solution is that the batch file will send the PC to standby, BUT this can only be done if I can override the Harmony "Power Off" command to a other command. And it seems this is not possible.
    I have a Harmony 650. I am not a Harmony expert, but I would expect to be able to re-assign any of the Harmony buttons to perform other functions.

    If you are using "Activities", the Harmony will send whatever codes are defined for POWER_ON and POWER_OFF as required. So what you need to do is modify those definitions for the HTPC device. In particular, you need to modify POWER_OFF so that it no longer sends SLEEP (which you cannot intercept), but instead sends some other MCE button code (which you can intercept).

    When I used WMC, I modified a button definition in a One-for-All remote control so that it sent the PRINT command when that button was pressed (yes, the MCE command set really does support PRINT!). The other change was to modify the "Report Mapping Table" in the Registry to translate PRINT to ALT_F4, so that I had a button to exit immediately from WMC.

    In your case, the following might work:
    (1) Modify your Harmony to send the MCE PRINT command for POWER_OFF for the HTPC device.
    (2) Modify the "Report Mapping Table" (in the Registry) to map PRINT to an obscure key combination of your choice (ALT_F5 perhaps, but not ALT_F4).
    (3) Use a tool to intercept that key combination and invoke your batch file. AutoHotKey could do this (which I have used), and EventGhost probably could too (which I have not used). However, I have a recollection that Windows 7 and later has some way of allowing users to define their own keyboard shortcuts. If you can find it, you could define ALT_F5 as invoking your batch file (so dispensing with AutoHotKey or EventGhost).

    I find it really strange that such a simple requirement seems to be so difficult to accomplish. It suggests that there is a simple and elegant way of doing this, but which none of us have yet spotted. :(

    -- from CyberSimian in the UK
     
    Last edited:

    Luca Brasi

    MP Donator
  • Premium Supporter
  • November 14, 2007
    1,026
    119
    Home Country
    Germany Germany
    Hi,
    I solved a similar thing with eventghost. First you'll have to teach your harmony to send an additional command before sending the sleep/power off command. I am running a harmony hub here and I was told that other harmonys don't have all the options mine has. So this might not be possible for you but you should have a look... In my case I set it up on the harmony action but it is possible to tweak that on the device as well. For the action go to the respective one in the harmony control center and chose the 4. menu item for that. In my german setup it's called "Diese Aktion anpassen":

    screen_mmnote_2016-08-11 07 57 24.png


    You'll be able to chose additional commands to send on start or end of this action:
    screen_mmnote_2016-08-11 07 54 50.png


    As you can see I added a command and a pause for the end of the action.
    Now, eventghost will pick up the Teletext command and this will trigger some actions in eventghost:

    screen_mmnote_2016-08-11 08 05 09.png


    Instead of the preend loop script in my case you'd trigger your batch here.
    You might notice that I have a macro for the final "htpc OFF" as well. This is because I taught my harmony not to send the pc to sleep but to use another command. So this is possible on my harmony as well and as it would be a solution for your requirement too you could have a look at that if the above solution doesn't work. Same goes for tweaking the harmony device with an additional command and a pause before the power off command.
    So if the the above is not available for you in the harmony control center let me know and I'll help you trying the other two options.

    Edits: Sorry for not reading the previous post from CyberSimian thoroughly and repeating some stuff he already said!
    And anther solution came to my mind: If you set windows not to go to standby or power off when the power button is pushed your system won't do anything when receiving the command from the harmony. But you can still pick up that command in eventghost, trigger the script and after some waiting send the sys to sleep from there.
     
    Last edited:

    Users who are viewing this thread

    Top Bottom