Jump to content

need help with keystroke script


esi
 Share

Recommended Posts

Dear community,

can you provide a newbee(me :mellow: ) with a simple script which detects the hotkey : SPACE as input and sends CTRL+SPACE as output.

The script should run forever until manually terminated.

Rgds, Eirikur.

Link to comment
Share on other sites

This would be quite a simple script to create. Here are the functions needed. Read thru them and write out some code. If you have problems, post back here your code and any questions and you'll get some help I'm sure.

HotKeySet

Send

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

The Ctrl+{Space} key stroke is: "^{SPACE}"

What you posted (with the square bracket corrected to a curly brace) would send CTRL, then send "+", then send "{SPACE}".

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Thanks for all the pointers.

The final script looks like this :

HotKeySet("{Space}", "captureSpace")

While 1

WEnd

Func captureSpace()

Send("^{SPACE}")

EndFunc

(If I place the script between while and wend I get syntax error)

A script to replace "x" with "y" which can be tested in a notepad document is as follows:

HotKeySet("x", "capturetest")

While 1

WEnd

Func capturetest()

Send("y")

EndFunc

Hopefully this sample can help someone else.

Rgds, Eirikur.

Link to comment
Share on other sites

Note what happens to your CPU usage (from Task Manager, Performance tab) while running that. You might want to put Sleep(10) inside that While/WEnd loop.

I would also give yourself a way to kill it, like a HotKeySet() for "{ESC}" that just exits the script.

:mellow:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
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...