Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Power button remapping


  • Please log in to reply
3 replies to this topic
Jeltesuper107
  • Members
  • 7 posts
  • Last active: Jun 05 2015 11:27 AM
  • Joined: 31 Jan 2015

I'm trying to remap the power button. I'd like to use it with a few other keys to put my display in sleep.  Like when i press crtl shift powerbutton that my display turns off (Just like on OS X). Is there a way to do this because I can't find the power button 'number' on the internet.

Help appreciated



lifeweaver
  • Members
  • 868 posts
  • Last active: Jan 25 2016 01:29 AM
  • Joined: 04 Mar 2013

Hi Jeltesuper107,

 

Not sure which 'power button' you speak of, one on your keyboard, the one on your pc case, the one on your monitor?

To merely powerdown your pc with a keypress I recommend looking at the AutoHotkey Shutdown command.

 

The below should shutdown your pc if ran, untested.

Shutdown, 1

My script runs in A_AhkVersion:=1.1.22.07, get the latest version at http://ahkscript.org/download/

Check out this AutoHotkey tutorial: http://ahkscript.git...o/AHK_Tutorial/

Read the documentation: http://ahkscript.org.../AutoHotkey.htm


Jeltesuper107
  • Members
  • 7 posts
  • Last active: Jun 05 2015 11:27 AM
  • Joined: 31 Jan 2015

I'm on a laptop, so i have a built-in keyboard. But I'm not trying to shut my pc down. I'm trying to use the powerbutton as a key in my hotkey to turn my laptop display off.
Like when i press ctrl shift powerbutton my laptop display turns off (not the laptop itself, only the display).



Masonjar13
  • Members
  • 1517 posts
  • Last active:
  • Joined: 16 Sep 2012

I'm unaware of the power button having a code, however, that doesn't mean there isn't one. You could try setting the power button (in the control panel under power settings > advanced settings) to do nothing, then running the following script:

#persistent
#installKeybdHook
keyHistory

Then, press the power button and refresh the AHK window. If there's a code for it, it should be listed there.

If it has a code, you may use it as a hotkey, combined with Ctrl or whatever you want. To turn off the screen: SendMessage,0x112,0xF170,2,,Program Manager


OS: Windows 7 Ultimate / Windows 8.1 Pro | Editor: Notepad++