Jump to content

Stuck CTRL key


Recommended Posts

I'm using AutoItX 3.3.16.1 from python 3.11 to perform a sequence of actions from my browser (Brave). Specifically:

1. set focus to the address bar

2. select all

3. copy to clipboard

To account for any lagging in the browser I put a half second delay between steps so I end up with

autoit.aut.send('!d')    # focus to address
autoit.aut.sleep(500)
autoit.aut.send('^a')    # select entire address
autoit.aut.sleep(500)
autoit.aut.send('^c')    # copy address
 

Following that I take the address from the clipboard, massage it, close the current tab, then browse to the massaged address

autoit.aut.send('^w') 
webbrowser.open(url)

I find that occasionally the CTRL key gets stuck in that if I use the mouse wheel to scroll I instead get zoom in/out as if I was doing CTRL+SCROLL. If I press CTRL manually I can then scroll.

1. is this a bug in autoitx?

2. is there a way, from within autoitx, to undo the "pressed" status of the CTRL key?
 

Edited by jdegraff
added version info
Link to comment
Share on other sites

@Nine your solution seems to works fine with AutoIt, I hope it will be same for OP with AutoItX
If everybody confirms there are no more "sticky keys" issue with your code, then why not updating the wiki link you indicated in your 1st post and add your solution to it ?

I just spent 10 minutes trying to break your code, with this script where I send Ctrl+a, but I couldn't break it (i.e. no sticky keys appeared)

1) What's actually in the script, that works (no sticky key, using a simplified version of the wiki code)

While _IsPressed("11") ; Ctrl = 11 . Important While to avoid a possible "sticky key" issue before Send("^a")
    Sleep(10)
WEnd
Send("^a")

2) Your solution, that works for me (no sticky keys) : comment out the 4 lines code above and add this :

Send("{CTRLDOWN}")
Send("a")
Send("{CTRLUP}")

3) Let's not be too greedy, because this 1 line code won't solve anything (sticky key appears randomly) :

Send("{CTRLDOWN}a{CTRLUP}") ; sticky key appears randomly

I wish everybody reading this gives a try to your code and report if they don't get the sticky key issue anymore.

Edited by pixelsearch
typo
Link to comment
Share on other sites

16 hours ago, pixelsearch said:

why not updating the wiki link you indicated in your 1st post and add your solution to it ?

Will do if OP can confirm that it is also working with AutoItX

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...