Cater Posted June 14, 2008 Posted June 14, 2008 (edited) Send("{RCTRL DOWN}") MouseClick("left", $slot1[0], $slot1[1], "1", ") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") and after that ctrl are still pressed until i press right ctrl, do anybody know how to solve this problem? Edited June 14, 2008 by Cater
Kiti Posted June 14, 2008 Posted June 14, 2008 I have often answered this question. Why does the Ctrl key get stuck down after I run my script? It could equally be the Shift or the Alt key. If you use Send in a script and you have a problem with keys being stuck down then Send is the most likely culprit. A similar problem can occur with BlockInput. The solution is generally quite simple. If there is a key like Shfit or Alt held down at the start of the Send sequence, but that key is released by the time the Send sequence finishes then the key will get 'stuck' down. As an example of a solution, you could replace the Send function in your script with the _SendEx function below. ;Send the string $ss after the Shift Alt and Ctrl keys are released. Optionally give a warning after 1 sec if any of those keys still down. ;Requires misc.au3 to be included in the script for the _IsPressed function. Func _SendEx($ss,$warn = "") Local $iT = TimerInit() While _IsPressed("10") Or _IsPressed("11") Or _IsPressed("12") if $warn <> "" and TimerDiff($iT) > 1000 Then MsgBox(262144, "Warning", $warn) EndIf sleep(50) WEnd Send($ss) EndFunc;==>_SendEx Extracted from FAQ. Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30
Kiti Posted June 14, 2008 Posted June 14, 2008 No problem. Read FAQ and Helpfile next time. It's a lot more satisfying when you find an answer yourself insted of somebody else serving it to you on a plate. Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30
Cater Posted June 14, 2008 Author Posted June 14, 2008 I use it like that Send("{RCTRL DOWN}") MouseClick("left", $slot1[0], $slot1[1], "1", "1") MouseClick("left", 611, 429, "1", "1") _SendEx("{RCTRL UP}", "") and that _SendEx("{RCTRL DOWN}", "") MouseClick("left", $slot1[0], $slot1[1], "1", "1") MouseClick("left", 611, 429, "1", "1") _SendEx("{RCTRL UP}", "") and that Send("{RCTRL DOWN}") MouseClick("left", $slot1[0], $slot1[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP"} _SendEx("{RCTRL UP}", "") and all this dont work, what iam doing wrong? =/
aslani Posted June 14, 2008 Posted June 14, 2008 Click the link on my signature. [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
Cater Posted June 14, 2008 Author Posted June 14, 2008 (edited) My script: expandcollapse popup#Include <Misc.au3> HotKeySet("{DELETE}", "mf") HotKeySet("{PGDN}", "bind") $slot = 1 $use = 1 While 1 Sleep(10) WEnd Func bind() If $slot = 1 Then Global $slot1 = MouseGetPos() $slot = 2 TrayTip("Apo mf", "Slot 1 zapisany", 1) ElseIf $slot = 2 Then Global $slot2 = MouseGetPos() $slot = 3 TrayTip("Apo mf", "Slot 2 zapisany", 1) ElseIf $slot = 3 Then Global $slot3 = MouseGetPos() $slot = 4 TrayTip("Apo mf", "Slot 3 zapisany", 1) ElseIf $slot = 4 Then Global $slot4 = MouseGetPos() $slot = 5 TrayTip("Apo mf", "Slot 4 zapisany", 1) ElseIf $slot = 5 Then Global $slot5 = MouseGetPos() $slot = 6 TrayTip("Apo mf", "Slot 5 zapisany", 1) ElseIf $slot = 6 Then Global $slot6 = MouseGetPos() $slot = 7 TrayTip("Apo mf", "Slot 6 zapisany", 1) ElseIf $slot = 7 Then Global $slot7 = MouseGetPos() $slot = 8 TrayTip("Apo mf", "Slot 7 zapisany", 1) ElseIf $slot = 8 Then Global $slot8 = MouseGetPos() $slot = 0 TrayTip("Apo mf", "Slot 8 zapisany", 1) HotKeySet("{PGDN}") EndIf EndFunc Func mf() If $use = 1 Then Send("{RCTRL DOWN}") MouseClick("left", $slot1[0], $slot1[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 2 ElseIf $use = 2 Then Send("{RCTRL DOWN}") MouseClick("left", $slot2[0], $slot2[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 3 ElseIf $use = 3 Then Send("{RCTRL DOWN}") MouseClick("left", $slot3[0], $slot3[1], "1", "1") MouseClick("left", 611, 429, "1", "1") _waitRelease() $use = 4 ElseIf $use = 4 Then Send("{RCTRL DOWN}") MouseClick("left", $slot4[0], $slot4[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 5 ElseIf $use = 5 Then Send("{RCTRL DOWN}") MouseClick("left", $slot5[0], $slot5[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 6 ElseIf $use = 6 Then Send("{RCTRL DOWN}") MouseClick("left", $slot6[0], $slot6[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 7 ElseIf $use = 7 Then Send("{RCTRL DOWN}") MouseClick("left", $slot7[0], $slot7[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 8 ElseIf $use = 8 Then Send("{RCTRL DOWN}") MouseClick("left", $slot8[0], $slot8[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 1 EndIf EndFunc Func _waitRelease() $dll = DllOpen("user32.dll") While 1 Sleep (100) If _IsPressed("10", $dll) OR _IsPressed("11", $dll) OR _IsPressed("12", $dll) Then Else ExitLoop EndIf WEnd DllClose($dll) EndFunc Where i have to use this func _waitRelease()? Edited June 14, 2008 by Cater
martin Posted June 14, 2008 Posted June 14, 2008 (edited) My script: expandcollapse popup#Include <Misc.au3> HotKeySet("{DELETE}", "mf") HotKeySet("{PGDN}", "bind") $slot = 1 $use = 1 While 1 Sleep(10) WEnd Func bind() If $slot = 1 Then Global $slot1 = MouseGetPos() $slot = 2 TrayTip("Apo mf", "Slot 1 zapisany", 1) ElseIf $slot = 2 Then Global $slot2 = MouseGetPos() $slot = 3 TrayTip("Apo mf", "Slot 2 zapisany", 1) ElseIf $slot = 3 Then Global $slot3 = MouseGetPos() $slot = 4 TrayTip("Apo mf", "Slot 3 zapisany", 1) ElseIf $slot = 4 Then Global $slot4 = MouseGetPos() $slot = 5 TrayTip("Apo mf", "Slot 4 zapisany", 1) ElseIf $slot = 5 Then Global $slot5 = MouseGetPos() $slot = 6 TrayTip("Apo mf", "Slot 5 zapisany", 1) ElseIf $slot = 6 Then Global $slot6 = MouseGetPos() $slot = 7 TrayTip("Apo mf", "Slot 6 zapisany", 1) ElseIf $slot = 7 Then Global $slot7 = MouseGetPos() $slot = 8 TrayTip("Apo mf", "Slot 7 zapisany", 1) ElseIf $slot = 8 Then Global $slot8 = MouseGetPos() $slot = 0 TrayTip("Apo mf", "Slot 8 zapisany", 1) HotKeySet("{PGDN}") EndIf EndFunc Func mf() If $use = 1 Then Send("{RCTRL DOWN}") MouseClick("left", $slot1[0], $slot1[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 2 ElseIf $use = 2 Then Send("{RCTRL DOWN}") MouseClick("left", $slot2[0], $slot2[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 3 ElseIf $use = 3 Then Send("{RCTRL DOWN}") MouseClick("left", $slot3[0], $slot3[1], "1", "1") MouseClick("left", 611, 429, "1", "1") _waitRelease() $use = 4 ElseIf $use = 4 Then Send("{RCTRL DOWN}") MouseClick("left", $slot4[0], $slot4[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 5 ElseIf $use = 5 Then Send("{RCTRL DOWN}") MouseClick("left", $slot5[0], $slot5[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 6 ElseIf $use = 6 Then Send("{RCTRL DOWN}") MouseClick("left", $slot6[0], $slot6[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 7 ElseIf $use = 7 Then Send("{RCTRL DOWN}") MouseClick("left", $slot7[0], $slot7[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 8 ElseIf $use = 8 Then Send("{RCTRL DOWN}") MouseClick("left", $slot8[0], $slot8[1], "1", "1") MouseClick("left", 611, 429, "1", "1") Send("{RCTRL UP}") $use = 1 EndIf EndFunc Func _waitRelease() $dll = DllOpen("user32.dll") While 1 Sleep (100) If _IsPressed("10", $dll) OR _IsPressed("11", $dll) OR _IsPressed("12", $dll) Then Else ExitLoop EndIf WEnd DllClose($dll) EndFunc Where i have to use this func _waitRelease()? The _waitRelease() function which is similar to the _SendEx function I wrote is not what you need for your problem. The idea with that function was that if someone presses a hot key sequence which results in Send being used, then using the _SendEx function instead of Send would prevent the CTRL key being held down for example, by waiting until that key was released until any characters were 'sent'. In your case the mouse button must be clicked while the Ctrl key is down so my guess is that the problem you have found is a feature of AutoIt and I suspect that it will be very difficult to find a way round it. When I understood what was causing keys to lock down with Send I reported it as a bug but it was made clear to me that it is not a bug, so I would expect that this won't be seen as a bug either. EDIT: If you use Send("{CTRLDOWN}") MOuseclick(... Send("{CTRLUP}") then you don't seem to get the problem, so if you don't have to use the right Ctrl key that might help. Edited June 15, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now