Jump to content
Sign in to follow this  
erezlevi

key stroke recognition

Recommended Posts

erezlevi

is there a way to write a scipt that waits for the key stroke : ctrl+alt+y to be pressed in any window, and then activate the rest of the script?

Share this post


Link to post
Share on other sites
star2

Just use HotKeySet() ....

that was the expert talking so u better take his words for it -- Jos has helped me a lot

here's an example of what u want

#include <guiconstants.au3>
; === no tray icon ====
TraySetState  (2)
 ; ==== the hotkey set  ====
HotKeySet ("^!y","activate")
; ======== creating the GUI =======
$the_GUI = GUICreate ("Test" , 150 , 80)
; =========== Create the buttons  ===============
$button = GUICtrlCreateButton ("Button" , 20 , 10 , 100, 25)
$exit = GUICtrlCreateButton ("Exit" , 20 , 45 , 100, 25)
; ====== setting the GUI state  =========
GUISetState (@SW_HIDE, $the_GUI)

; ====== looping  ==============
While 1
    $msg = GUIGetMsg ()
    ; ========= this event is for closing the program  ========
    If $msg = $gui_event_close Then Exit
    Select
    ; ==== buttons events  ======
        Case $msg = $exit
            Exit
        Case $msg = $button
            MsgBox (-1 , "test" , " this is a test")
    EndSelect
WEnd

Func activate()
    GUISetState (@SW_SHOW, $the_GUI)
EndFunc

[quote]Baby you're all that I want, When you're lyin' here in my armsI'm findin' it hard to believe, We're in heavenAnd love is all that I need , And I found it there in your heartIt isn't too hard to see, We're in heaven .Bryan Adams[/quote].............................................................................[u]AUTOIT[/u]

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  

×