Jump to content

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

ON and OFF monitor and keypad using Specific hotkeys


  • Please log in to reply
1 reply to this topic
AMSTERDAM123
  • Members
  • 2 posts
  • Last active: Dec 10 2014 09:50 PM
  • Joined: 16 Oct 2014

Hi all,

my .ahk script not working what i expect, please correct the code I have below script for on and off monitor using AutoHotKeys. It should work on Windows 7 and Windows 2008 server. need to rewrite the code, please help me.

 

If I press ctrl+1 it should off the monitor  (and it goes to full black screen,I use the GUI,COLOR,0X000000) and all the keyboard keys disable (except for ctrl+1 key). If I press ctrl+1 it should show up the windows 7/ Windows 2008  lock screen which is ctrl+alt+delete screen, and also enable all keyboard keys. If press cntrl+alt+delete it goes to windows logon page (username and password page).  This process toggle every time I hit ctrl+1.

I tested below code:

I don't have problem with turnoff monitor using ctrl+1(it works perfect). If I press random keys and press the ctrl+1 it does not show up ctrl+alt+delete screen instead it still black screen. 

 

 

Code:

^1::
KeyWait, CTRL
KeyWait, ALT
KeyWait, F4
KeyWait, SHIFT
KeyWait, Escape
KeyWait, Delete 
GUI,COLOR,0x000000 ; or  RunWait, scrnsave.scr /s   for the black screensaver  
;Gui,-Caption
;Gui,Show,w%A_ScreenWidth% h%A_ScreenHeight%
;BlockInput,on
Loop
{
If (GetKeyState("CTRL","P") and GetKeyState("1","P"))
 {
Run, rundll32 user32.dll`,LockWorkStation
SendMessage, 0x112, 0xF170, -1,, Program Manager
;BlockInput,off
break
}
else  if (A_TimeIdlePhysical<1000)
SendMessage, 0x112, 0xF170, 2,, Program Manager
}
;Run, rundll32 user32.dll`,LockWorkStation
GUI,Destroy
;Run, rundll32 user32.dll`,LockWorkStation
;Esc::ExitApp
Return


AMSTERDAM123
  • Members
  • 2 posts
  • Last active: Dec 10 2014 09:50 PM
  • Joined: 16 Oct 2014

I need help.I don't have much knowledge on .ahk. I combined two separate codes. Could any one give me some suggestion.