Jump to content

Recommended Posts

Posted

I want to do a script that works like this:

As long as I'm holding down my C button on my keyboard, I want the SPACE button to be held down too.

When I later release the C button on my keyboard, I want the SPACE button to be released too.

How can I do a script like this?

Posted (edited)

The problem, as I see it, is that the keys you want to use can only be sent separately - one at a time. It isn't like holding down the control, or alt key to combine with another key. If I am correct, then remapping may be the only solution. I haven't tested it and I could be wrong. You could try setting 'c' as a hotkey to call a function. It might work with some tweaks. It seems a strange thing to do though.

Edited by czardas
Posted (edited)

I can't remember the function that disables the keyboard and mouse intput, but you can probably use that, with a _IsPressed loop to do what you require...(then just send "C " in a loop)...I'd add a timer limit to it, to make sure you can become responsive again, while testing.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted

thi

I can't remember the function that disables the keyboard and mouse intput, but you can probably use that, with a _IsPressed loop to do what you require...(then just send "C " in a loop)...I'd add a timer limit to it, to make sure you can become responsive again, while testing.

Hmmm, I'll test that out.

Posted (edited)

Okay I was wrong.

;

#include <Misc.au3>

HotKeySet("c", "space")
HotKeySet("{ESC}", "quit")

Global $dll = DllOpen("user32.dll")

While 1
    Sleep(10)
WEnd

Func space()
    While _IsPressed("43")
        Send("{SPACE}")
    WEnd
EndFunc

Func quit()
    DllClose($dll)
    Exit
EndFunc

;

If you want to make it less sensitive, add a sleep value to the function - after Send().

Edited by czardas

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