AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Hot Key Modifier Not Working

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
iamnu



Joined: 31 May 2007
Posts: 23

PostPosted: Mon Nov 16, 2009 3:14 pm    Post subject: Hot Key Modifier Not Working Reply with quote

#H::
{
; Call the Windows API function "SetSuspendState" to have the system suspend or hibernate.
; Windows 95/NT4: Since this function does not exist, the following call would have no effect.
; Parameter #1: Pass 1 instead of 0 to hibernate rather than suspend.
; Parameter #2: Pass 1 instead of 0 to suspend immediately rather than asking each application for permission.
; Parameter #3: Pass 1 instead of 0 to disable all wake events.

DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
Return
}


If I change the Hotkey from #H:: to ^Numpad0:: then this code is not executed when I enter ctrl+0 on the numpad.

Can someone explain?
Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Mon Nov 16, 2009 3:43 pm    Post subject: Reply with quote

I can't really explain, because it works for me (including Hibernate).
But aren't there any modifier keys stuck (not physically but acting like they are down)?
Just a remark, you don't need the braces {}, only in Functions, if-else, etc.
Although it seems to work, code like this is the normal way:
Code:
^Numpad0::
   msgbox test
   DllCall("PowrProf\SetSuspendState", "int", 1, "int", 0, "int", 0)
return
Back to top
View user's profile Send private message
iamnu



Joined: 31 May 2007
Posts: 23

PostPosted: Mon Nov 16, 2009 4:50 pm    Post subject: Reply with quote

Thanks for the reply.

I removed the braces, and my original Hotkey still works, but the new one still does not. No stuck keys either...
Back to top
View user's profile Send private message
Peter



Joined: 30 Dec 2005
Posts: 448

PostPosted: Tue Nov 17, 2009 2:34 am    Post subject: Reply with quote

Does it work with e.g. ^H hotkey?
Try script below, it should show the Ctrl and Numpad0 status. You can extend the script with other keys.
In case you have another keyboard, try with that one. If it's a hardware problem, then it could save you a lot of time.
Code:
Loop {
   numpad0Key := GetKeyState("Numpad0", "P")
   ctrlKey := GetKeyState("ctrl", "P")
   tooltip ctrlKey= %ctrlKey% `nnumpad0Key= %numpad0Key%
   Sleep 100
}
return
F9::ExitApp
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group