Jump to content
Sign in to follow this  
mikemuska

Holding Down X Script

Recommended Posts

mikemuska

I'm kinda new to the whole scripting thing and im trying to make a script that holds the X key when i press ctrl+g and then press it again to make it stop. I don't even really know where to start. Also if possible I want to make it into a exe

Share this post


Link to post
Share on other sites
mikemuska

So what did you try ?

Did you have a look at the documentation ?

I tried

Send("{x down}") ;Holds the x key down

Send("{x up}") ;Releases the x key"
 
and a few other lines of code i found on the forums but they were for different tasks and didn't work and documentation?

Share this post


Link to post
Share on other sites
JLogan3o13

What kind of window are you trying to manipulate with your Sends? There is most often a much better way of accomplishing what you're trying to do.


√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites
mikemuska
Global $run = False

HotKeySet("^g", "_start")

While 1
    Sleep(100)
WEnd

Func _start()

    $run = Not $run

    While $run
        If $run Then
            Send("{x down}")
        Else
            Send("{x up}")
        EndIf
    WEnd

EndFunc

Is this helps ? just compile it

Big thanks worked perfectly only thing I changed was the ^g because it was bugging out my keyboard when used that hotkey.

Share this post


Link to post
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
Sign in to follow this  

×