DanielT Posted June 26, 2023 Share Posted June 26, 2023 Before, on my old computer running win10, I never had any problems interrupting scripts by seting a hotkey to call an exit function. Now on the new computer with win11 it seems that I'm no longer able to interrupt a scripts unless I call a sleep function. Sadly I have no way to tell exactly what version of autoit I was running back then, but right now I'm using v3.3.16.1. Here's a basic script which I'm unable to interrupt by hitting ESC: HotKeySet("{ESC}", "Stop") MouseClick("left", 300, 300) MouseClick("left", 600, 300) MouseClick("left", 600, 600) MouseClick("left", 300, 600) MouseClick("left", 300, 300) MouseClick("left", 600, 300) MouseClick("left", 600, 600) MouseClick("left", 300, 600) Func Stop() Exit EndFunc Now if I add sleep in between the clicks then I'm able to interrupt the script: HotKeySet("{ESC}", "Stop") MouseClick("left", 300, 300) Sleep(100) MouseClick("left", 600, 300) Sleep(100) MouseClick("left", 600, 600) Sleep(100) MouseClick("left", 300, 600) Sleep(100) MouseClick("left", 300, 300) Sleep(100) MouseClick("left", 600, 300) Sleep(100) MouseClick("left", 600, 600) Sleep(100) MouseClick("left", 300, 600) Func Stop() Exit EndFunc Ty for any help. Link to comment Share on other sites More sharing options...
Andreik Posted June 26, 2023 Share Posted June 26, 2023 I doubt you have time to interrupt the first script. Probably ends before you have the chance to press ESC. Maybe posting a full script you'll get more support. Link to comment Share on other sites More sharing options...
DanielT Posted June 26, 2023 Author Share Posted June 26, 2023 It takes around 4s to end, but even if I increase the amounf ot instructions for it to take 10+ seconds I still cant interrupt it. Here's an actual script that I was able to interrupt before: expandcollapse popup#RequireAdmin HotkeySet ("{F10}", "Stop") ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; accept button position $xAcceptPos = 1816 $yAcceptPos = 350 ; decrease button position $xDecreasePos = 1779 $yDecreasePos = 324 ; first slot position $xSlotPos = 1745 $ySlotPos = 286 ; y distance $yDistance = 18 ; delay for after restoring window $restoreDelay = 1000 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Open window MouseClick( "left", 90, 1060) ; Wait for it to open Sleep( $restoreDelay ) $i = 1 While $i < 999999 If Mod($i, 2) = 0 Then MouseClick( "left", $xSlotPos, $ySlotPos + $yDistance) MouseClick( "left", $xSlotPos, $ySlotPos) MouseClick( "left", $xDecreasePos, $yDecreasePos) MouseClick( "left", $xAcceptPos, $yAcceptPos) Else MouseClick( "left", $xSlotPos, $ySlotPos) MouseClick( "left", $xSlotPos, $ySlotPos + $yDistance) MouseClick( "left", $xDecreasePos, $yDecreasePos + $yDistance) MouseClick( "left", $xAcceptPos, $yAcceptPos + $yDistance) EndIf Send("1") $i = $i + 1 WEnd Func Stop () Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Andreik Posted June 26, 2023 Share Posted June 26, 2023 (edited) I have to admit, that's a strange behavior. I tried the code below and I see what you mean. If I add a tiny sleep of 10 ms it works but If I just delay the mouse clicks even with 100 ms still doesn't work. Also in an infinite loop or if I do some other operations in the loop the hot key is triggered but not with MouseClick(). I'm not sure about the internal implementation of these functions so I can't say if it's a bug. Maybe others can try this code on different OS to check if this issue is persistent. ;~ AutoItSetOption('MouseClickDelay', 100) HotKeySet("{ESC}", "Stop") $Timer = TimerInit() While TimerDiff($Timer) < 10000 MouseClick("left", 300, 600) ;~ Sleep(10) WEnd Func Stop() Exit EndFunc Edited June 26, 2023 by Andreik Link to comment Share on other sites More sharing options...
Solution DanielT Posted June 28, 2023 Author Solution Share Posted June 28, 2023 So by installing v3.3.14.5 I was able to get it to work again. Link to comment Share on other sites More sharing options...
Andreik Posted June 28, 2023 Share Posted June 28, 2023 Probably you can open a ticket. It has to be an explanation of this behavior. Link to comment Share on other sites More sharing options...
argumentum Posted June 28, 2023 Share Posted June 28, 2023 (edited) Edit: ..yeap, it'd need a ticket. Edited June 28, 2023 by argumentum Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Andreik Posted June 28, 2023 Share Posted June 28, 2023 Doesn't have anything to do with the speed, as I tried before. It's something else. Link to comment Share on other sites More sharing options...
DanielT Posted July 16, 2023 Author Share Posted July 16, 2023 Sorry it took so long. Here's the ticket:https://www.autoitscript.com/trac/autoit/ticket/3962#ticket argumentum 1 Link to comment Share on other sites More sharing options...
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