I am trying to record a ClipGet after Ctrl + C Is stroke.
Not working. It is possible ?
While (1) $msg = GUIGetMsg () Switch $msg Case $GUI_EVENT_CLOSE Exit EndSwitch Local $hDLL = DllOpen("user32.dll") If _IsPressed ("A2",$hDLL) And _IsPressed ("56",$hDLL) Then Sleep (500) $ClipBoard = ClipGet () ;~ ==========================================Console============================================ _GUICtrlListView_AddItem($ConsoleArea,""&$ClipBoard) _GUICtrlListView_EnsureVisible($ConsoleArea, _GUICtrlListView_GetItemCount($ConsoleArea)-1) ;~ =========================================/Console============================================ EndIf DllClose ($hDLL) WEnd
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.
Right now the script will exit immediately if I don't pause it somehow (obvious of course).
I was curious on people's opinions of how they do it or what option they prefer below? Thanks
Option 1 (I prefer)
#include <MsgBoxConstants.au3> HotKeySet('^!p', SomeFunc) ProcessWaitClose(@AutoItPID) Func SomeFunc() MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) EndFunc Option 2 (in the help file)
#include <MsgBoxConstants.au3> HotKeySet('^!p', SomeFunc) While Sleep(100) WEnd Func SomeFunc() MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) EndFunc Option 3
#include <MsgBoxConstants.au3> HotKeySet('^!p', SomeFunc) While 1 GUIGetMsg() ; Use the internal sleep WEnd Func SomeFunc() MsgBox($MB_SYSTEMMODAL, "Title", "This message box will timeout after 10 seconds or select the OK button.", 10) EndFunc
Dear developers and creators of the language, please explain to me why when pressing the combination Crtl + Shift + C from the 5th or the 10th time "sticks / sinks" Ctrl or Shift? And then you need to press Ctrl or Shift again to reset their triggering. I only need to use hot keys like in the example!
The code is a small example. Its essence is that when a user in the editor selects any number and presses a combination, then it increases by 1.
Dim $x HotKeySet("+^c","Calc") While 1 Sleep(10000) WEnd Func Calc() Send("^c") Sleep(50) $x=ClipGet()+1 ClipPut($x) Send("^v") EndFunc I thought that in my program some kind of glitch was searching for a reason for a long time. And it turned out that apparently somehow the work of some functions used in the example is not compatible.
Tell me, please, what is the problem?
Hello to all,
I've written a script using following part is inserted.
Func _CallFolder() ; .... Local $_hDLL = DllOpen("user32.dll") ; .... ; .... While 1 ; .... ; .... If _IsPressed("1b",$_hDLL) then _Terminate($_hDll,$_iPID,$_hGUI) Sleep(10) WEnd ; .... ; .... EndFunc Func _Terminate($_para1, $_para2, $_para3) DllClose($_para1) ProcessClose($_para2) GUIDelete($_para3) Exit EndFunc The script is working right. But on typing "ESC" not only my script is closing all other open programs using "ESC" for termination too going closed.
I've no idea why that happens.
Maybe one of the "profis" can help me on it.
Please ecxuse my bad English but I'm a German trying his best.
Thank you and best regards, HalleMike