Jump to content

Recommended Posts

Posted

I'm trying to write my first AutoIt script and it's going disastrously wrong, was wondering if anyone can help.  It's not much more complicated than a "Hello World" piece of code, but I've been at it for hours and am incredibly frustrated.

The purpose of the program is to send a complex password when I press a key combo.  The password consists of upper- and lowercase letters, numbers, and punctuation.  This is the code I'm using:

HotKeySet( "^!p", "SendPass" ) ; Ctl-Alt-p

; Just go to sleep forever
While 1
    Sleep(1000)
 WEnd

Func SendPass()
      Send( "PassWord(%^#", 1 )
 EndFunc ; SendPass()

The problem I have is that the Ctl-Alt key combination I use to invoke the HotKey "sticks".  i.e. - When the function ends and control returns to the user, the "Ctl" and "Alt" keys are stuck in the pressed condition.  Every key I press from that point forward is interpreted by Windows as a Ctl-Alt key combo.  The only way I can "unstick" the keys is by manually pressing Ctl and Alt again.

I've tried changing the password string to escape all special characters ( i.e. - "+pass+word(%{^}{#}" ) and invoking Send so it *doesn't* send raw keystrokes, but the effect is identical.  If my password is pure lowercase text everything works, but who has a password with no uppercase characters or punctuation?  

Thanks in advance for any ideas!

Posted

Thank-you, using ControlSend solved the issue.  It seems like something is broken out of the box, because even the sample code in the documentation for HotKeySet will fail if you send more than 3 or 4 characters at once.  But thank-you to the helpful people who set me on the right path.  :)

Posted

I have suffered this issue before with the modifier keys.

Usually just decided to use an F Key or something to work around it.

 

Your sleep of 1000ms is higher than you need something like 10ms will save you the cpu cycles but make your hotkey more responsive.

 

Regards,

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
  • Recently Browsing   0 members

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