Jump to content
Sign in to follow this  
m4tius

HotKey problem

Recommended Posts

Do you mean for example ALT + F11 like the example below.

#Include <HotKey.au3>

Global Const $VK_ESCAPE = 0x1B
Global Const $VK_F11 = 0x7A

; Assign "ALT-F11" with Message() and set extended function call
_HotKeyAssign(BitOR($CK_ALT, $VK_F11), 'Message', BitOR($HK_FLAG_DEFAULT, $HK_FLAG_EXTENDEDCALL))

; Assign "CTRL-ESC" with Quit()
_HotKeyAssign(BitOR($CK_CONTROL, $VK_ESCAPE), 'Quit')

While 1
    Sleep(10)
WEnd

Func Message($iKey)
    MsgBox(0, 'Hot key Test Message', 'F11 (0x' & Hex($iKey, 4) & ') has been pressed!')
EndFunc   ;==>Message

Func Quit()
    Exit
EndFunc   ;==>Quit

If you mean to use the keys ALT, CTRL or SHIFT by themselves to run a function that may not be possible.

jfcby


Determined -- Devoted -- Delivered Make your mind up -- to seriously apply yourself -- accomplishing the desired results. **** A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB ****

Share this post


Link to post
Share on other sites

Could anyone tell me how to bind a shift, alt or ctrl with a function using Hotkey?

The Send commands listed in the Remarks section there pretty much apply to Hotkey, as to what keys it will accept. Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

Im really angry cuz in autohotkey i could bind these keys same like space or letters... But i need it in autoit, it can be any other function however HotKey looks nice.

Of course i need these keys only, any other keys with it.

Edited by m4tius

Share this post


Link to post
Share on other sites

Text from Help:

This tells AutoIt to send a CONTROL keystroke, therefore Send("^!a") would send "CTRL+ALT+a".

N.B. Some programs are very choosy about capital letters and CTRL keys, i.e. "^A" is different to "^a". The first says CTRL+SHIFT+A, the second is CTRL+a. If in doubt, use lowercase!

You may get more info by entering HotKeySet in search field in Help.

Edited by Makaule

Share this post


Link to post
Share on other sites

^

The following hotkeys cannot be set:

Alt, Ctrl, Shift, Win These are the modifier keys themselves!

Share this post


Link to post
Share on other sites

Depending on what you want to do you could take a look at _IsPressed(), or GUIRegisterMsg($WM_KEYDOWN,"Yourfunc")

The first will have to be called in a loop. It doesn't run if the script is inside another function.

The second only works inside the scripts GUI I think.

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...