Sign in to follow this  
Followers 0
PianothShaveck

HotKeySet problem

6 posts in this topic

I already searched on the web, on the online (and also offline) documentation and on the forum but I didn't find this problem (maybe I didn't search well anyway)...

I often use HotKeySet ( "key" [, "function"] ) in my scripts, but I noticed that for the character "." and also for ":" it doesn't work.

This is a rapid example (also attached):

#include <GUIConstantsEx.au3>

HotKeySet(".", "f1")
HotKeySet("+.", "f2")
HotKeySet(",", "f3")

$g_1 = GUICreate("Example", 800, 500)
GUISetState()

While 1
   $msg = GUIGetMsg()
   Select
      Case $msg == $GUI_EVENT_CLOSE
         ExitLoop
   EndSelect
WEnd

Func f1()
   ;Do something like for example
   MsgBox(0, "", "Hello World")
EndFunc

Func f2()
   ;Do something else like for example
   MsgBox(0, "", "Hello World 2")
EndFunc

Func f3()
   ;Do something else like for example
   MsgBox(0, "", "Hello World 3")
   ;This is the only one that works
EndFunc

Can you at least tell me why? In the online documentation it says:

The following hotkeys cannot be set:

Ctrl+Alt+Delete It is reserved by Windows F12 It is also reserved by Windows, according to its API. NumPad's Enter Key Instead, use {Enter} which captures both Enter keys on the keyboard. Win+B,D,E,F,L,M,R,U; and Win+Shift+M These are built-in Windows shortcuts. Note: Win+B and Win+L might only be reserved on Windows XP and above. Alt, Ctrl, Shift, Win These are the modifier keys themselves! Other Any global hotkeys a user has defined using third-party software, any combos of two or more "base keys" such as '{F1}{F2}', and any keys of the form '{LALT}' or '{ALTDOWN}'.

P.S. Sorry for some grammatical errors, I'm Italian.

Example.au3

Share this post


Link to post
Share on other sites



Just a note, may want to add Sleep(100) in your while loop so you don't cook your CPU.


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

Of course, but that was just an example I made in less than a minute, nothing serious.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Just a note, may want to add Sleep(100) in your while loop so you don't cook your CPU.

The 10ms from GUIGetMsg() already prevents cooking. Another 100ms won't do (much) difference.

@PianothShaveck

The script you posted works fine, what's the problem you want help with?

Edited by AdmiralAlkex

Share this post


Link to post
Share on other sites

The problem is that (al least on my computer, I don't know about yours) when I press "." or ":" it doesn't do anything.

Share this post


Link to post
Share on other sites

It works for me (Swedish keyboard layout) but fails if I change to Italian layout. Italian must be doing something icky. I don't know about "proper solutions", but found a workaround in _WinAPI_LoadKeyboardLayoutEx.

And I didn't say it earlier so: Hi and Welcome to the forum!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0