Jump to content

Recommended Posts

Posted (edited)

Kind of odd what's going on

When I press Left Ctrl -_Ispressed("A2")- my computer thinks the key is being held down causing a bunch of problems for me. Even when I stop the script my computer thinks the key is held down. What's even odder is I set it up to count how many times it detected the key being pressed and it would stop then, it only messes up when I try to add a Send or anything else to it.

I have tried it with a lot of other keys as well and they all gave the same problem, I also checked sticky keys and they are all turned off.

Thank you in advance for any tips or suggestions!

Friendly note: If you decide to run the code below it will make your system act odd, a simple fix is to press "Ctrl + Alt + Del" and then cancel. It fixes whatever is causing the problem.

#include <Misc.au3>
$gui = GUICreate("Auto Typer",300,120,-1,-1)
Opt("GUIOnEventMode",1)
GUISetOnEvent(-3,"_Exit")
$text = GUICtrlCreateInput("",5,5,290,20)
GUICtrlSetState($text,1)
Global $stunt = False, $p = 0
$send = GUICtrlCreateCheckbox("Send",5,50,100,20)
GUISetState()

While 1
    If _IsPressed("A2") Then
        If GUICtrlRead($send) = 4 Then
        $p += 1
        GUICtrlSetData($text,$p)
        EndIf
        $stunt = True
    EndIf
    If $stunt = True And GUICtrlRead($send) = 1 Then
        Send("Hi")
        $stunt = False
    EndIf
    Sleep(10)
WEnd

Func _Exit()
    Exit
EndFunc

 

Edited by gottygolly
Posted

Appreciate it

I figured out a solution that works, I added another _IsPressed() that waits till it's no longer pressed then it calls the function

#include <Misc.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
$gui = GUICreate("Example [Sent: 0]",300,120,-1,-1)
Opt("GUIOnEventMode",1)
GUISetOnEvent(-3,"_Exit")
$text = GUICtrlCreateInput("",5,5,290,20)
GUICtrlSendMsg($text,$EM_SETCUEBANNER,False,"Press Left Control To Send Text")
$invis = GUICtrlCreateLabel("",-50,-50,0,0)
GUICtrlSetState($invis,$GUI_FOCUS)
$Counter = 0
GUISetState()

While 1
    If _IsPressed("A2") Then
        While _IsPressed("A2")
            Sleep(10)
        WEnd
        $Counter += 1
        WinSetTitle($gui,"","Example [Sent: "&$Counter&"]")
        Send("Beep Bop - ")
    EndIf
    Sleep(10)
WEnd

Func _Exit()
    Exit
EndFunc

 

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...