Jump to content

Detect what key is pressed


Go to solution Solved by FireFox,

Recommended Posts

Posted (edited)

Ok, I've searched again my butt off on the web, and therefor asking it here....

I want to add custom hotkeys which a user can set themself to start applications

Since I done so much research about this, even on the forum I'm sure this question will be frowned upon.

However I don't need a continues check on input, just a single one and even better a combination of ones e.a. alt+1

Example

#include <GUIConstantsEx.au3>

Local $Button_1, $Button_2, $msg
GUICreate("Example") ;
$Button_1 = GUICtrlCreateButton("Run Notepad", 10, 30, 100)
GUISetState()
While 1
   $msg = GUIGetMsg()
   Select
      Case $msg = $GUI_EVENT_CLOSE
         ExitLoop
      Case $msg = $Button_1
         $HotkeyButton = "some way to detect what key is pressed...."
         HotKeySet ($HotkeyButton, "Notepad")
   EndSelect
WEnd

Func Notepad()
   Run(@WindowsDir & "\notepad.exe")
EndFunc
 
Edited by Hawkysoft

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
×
×
  • Create New...