if you do a little search, you will find this app already.
Run programs on hibernate/suspend and resume!
I've been looking and looking, but can't find this. Does anyone know if there is a Windows utility (software) that will change the behavior of the hardware power button of the computer?
What I envision is a util that will allow me to tie an application or script to the power button. Such that if I press the power button, it will launch the app (or execute the script).
I'm sure you know why this is useful. Imagine how great it would be if when the Opus initiates a shutdown sequence (or hibernation sequence) throught the ATX power connector, it could launch a script INSTEAD! Then you could have your script do a number of things such as synchronize files, shutdown devices, etc. etc. and then at the end send a shutdown or hibernate command.
The closest workaround I've seen is a utility (posted on this forum) that intercepts the hibernation sequence and allows you to launch an app/script, but the problem is that if the app you're launching takes more than 20 seconds to 'do its thing' then Windows forces it to close because it thinks the app has crashed.
Any help finding something like this would eliminate a lot of headaches for a lot of people in this forum. Please post if you find anything.
If you do a little reading of my message above, you would know that:
1)This is not what I am looking for, and
2) My message above even refers to that specific utility on that thread, as the 'workaround' to what I want.
I'm sick of the search Police. Especially the lousy ones.
EDIT: Ok, OK... at least I give credit for trying to help me out Sorry for the initial burst of frustration.
Originally Posted by MatrixPC
matrix, that's exactly what he was talking about. and as he stated, that gives you a max of about 20 seconds to get all the stuff done. if you have file synchronization or something that will take longer, you're screwed.Originally Posted by justintime
looks like we need some "at least read their post before you tell them to search" police around here to police the search police
perhaps it would be easier to tie your script to something other than the actual power button... like a line on the serial port or parallel port or something. you could just connect the SDC to that instead of the power button pins on the mobo header. at most, it might require a couple resistors for interfacing... but you'd get easier access to it than you would with the power button (as you have seen)
But don't take it from me! here's a quote from a real, live newbie:
eegeek.netOriginally Posted by Viscouse
Yeah, one solution I had in mind, was to wire the Opus to an IPAC device (a keyboard encoder), and program the IPAC input to be say, F10 key.
Then simply assign F10 on the carputer to launch the script.
But it is OVERKILL! I resist from doing that, even though I have 4 IPACs sitting on ym desk, with no intended use.
Originally Posted by evandude
Well, unlike most guys in this forum who always slap icon to every opportunity.
That is one of the ultility that can be use, but things you want to do take longer than windows allow. My bad.
I don' t think there is a software solution to what you want to do cuz the button is part of the ACPI spec which is implemented by the mobo. If there is software solution, it has to be part of the OS.
The only solution is the hardware solution either thru com port and/or the SDC.
There is a way using the API to detect for the shutdown of a machine, cancel it, run some apps then reinitiate shutdown, I can't remember the exact API calls but it can't be too hard to find them.
That makes a ton of sense.
Maybe one can use the suspend utility mentioned above, to run a script with the following instructions:
<First, the suspend.exe detects the hibernation request, and it runs the script...>
a) Cancel the hibernation sequence (trick is, how to do this?!)
b) run everything you want here
c) Initiate a hibernation sequence command (must be an easy way to do this)
Any more seasoned scripters want to have a go at this?
Originally Posted by UK_MP3Car
instead you could use code that just captures the hibernate message from windows...and in its routing to "prepare for hibernation" do the routine you are looking for. So i think all you need is the code that everyone uses to "survive" hibernation
a) invoking shutdown -a cancels hibernation, but i'm sure there is an api way to do it