Search the Community
Showing results for tags 'pressed'.
-
Hi guys, I'm learning about GUI's, I'm trying the below code, the idea being if I press the letter "e" while I have the GUI open I want the label color to change to green (I'm using a UDF for label colors). But every time I press "e" on my keyboard I just get a "ding" sound from my speakers and nothing changes with the label. I've looked at using something like "While GUIGetMsg() <> $GUI_EVENT_CLOSE" as I've seen it in other code instead of "While 1", but I don't think it's relevant. #include <GUIConstantsEx.au3>; for GUI... #include <GUIRichLabel.au3>; UDF for rich text label fonts #include <Misc.au3>; for _IsPressed $myLetter = "e" $hGUI = GUICreate("test", 700, 60) $lbl2 = _GUICtrlRichLabel_Create($hGUI, '<font color="purple">' & $myLetter & '</font>', 10, 10); , 260, 25 GUISetState(@SW_SHOW) Local $hDLL = DllOpen("user32.dll") While 1 if _IsPressed(Hex($myLetter), $hDLL) Then While _IsPressed(Hex($myLetter), $hDLL) Sleep(250) WEnd _GUICtrlRichLabel_SetData($lbl2, '<font color="green">' & $myLetter & '</font>') Sleep(2000) DllClose($hDLL) Exit EndIf Sleep(50) WEnd DllClose($hDLL) I am using an array of letters that I'm wanting to do this for, but as I can't get it to work I've stripped it down to the simplest code I can think of to try and get this working first. Appreciate any help. Thanks!
- 16 replies
-
- _ispressed
- pressed
-
(and 3 more)
Tagged with:
-
i found this script by melba23 and its exactly what i wanted > link #include <Misc.au3> #include <MsgBoxConstants.au3> Local $hDLL = DllOpen("user32.dll") HotKeySet("{q}","_Start") ; Fire HotKey on q key HotKeySet("{ESC}", "_Exit") While 1 Sleep(10) WEnd Func _Start () ; Look for w key If _IsPressed("57", $hDLL) Then ; Only action if BOTH pressed MsgBox($MB_SYSTEMMODAL, "", "Got it") EndIf EndFunc Func _Exit() DllClose($hDLL) Exit EndFunc if im not wrong, if i hold q key first and then press w key, then the output will be messagebox that says "got it" but when i tested it, it doesnt do anything. but if i reverse the order, hold w key first, and then press q key, it works. now i dont know why is this happen, or is this how this script supposed to do? or there's something wrong? thank you.
-
Hi all I want a way to get the last key pressed. I have a program that works with keyboard shortcuts and I want to give the permission for the user to edit shortcut keys depending on what suits him i want to make read-only edit box and the program writes the latest shortcut key pressed Please help me, greetings to all And thanks in advance
-
hello guys how are you؟ I hope to be fine. I have a question please how do I get the menu item that was pressed without that contains a variable؟ For example I have a menu of Favorites and I want the script recognizes the existing path in the pressed item i'll repeat to tell the item does not contain a variable Is there any solution if you want to explain more I could write an example of what I want. Greetings to all, thanks in advance