Sign in to follow this  
Followers 0
RippaN

Send keys to a program.

3 posts in this topic

Hi,

Im making a script which presses "8" on keyboard every 10 second.

But for this to work with the program i need to have it ontop all the time which makes me not available to do something else i the meantime.. Is there anyway you could script so the sendkey 8 command would only affect this program, and send it to the program even tho its in the background?

I've tried search for this :/

my code looks like this:

Opt("ColorMode", 1)
Opt("SendKeyDownDelay", 1)
Opt("SendKeyDelay", 1)

$1 = 0

Do
Send("{8 down}")
Send("{8 up}")
Sleep (10000)

$1 = $1 + 1
Until $1 = 1000000000000

Share this post


Link to post
Share on other sites



Hi,

Im making a script which presses "8" on keyboard every 10 second.

But for this to work with the program i need to have it ontop all the time which makes me not available to do something else i the meantime.. Is there anyway you could script so the sendkey 8 command would only affect this program, and send it to the program even tho its in the background?

I've tried search for this :/

my code looks like this:

Opt("ColorMode", 1)
Opt("SendKeyDownDelay", 1)
Opt("SendKeyDelay", 1)

$1 = 0

Do
Send("{8 down}")
Send("{8 up}")
Sleep (10000)

$1 = $1 + 1
Until $1 = 1000000000000
You could try using ControlSend


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I have tried the code beneath but I dont get it to worked, ive tried ControlSend with other Applications too aswell but i dont get it to work there either.. I must be doing somewhing wrong here.

Opt("ColorMode", 1)
Opt("SendKeyDownDelay", 1)
Opt("SendKeyDelay", 1)

$1 = 0

Do
ControlSend("Horizons", "", "", "8")
Sleep (10000)

$1 = $1 + 1
Until $1 = 1000000000000

EDIT:

Ive got the keypresses to work by this line:

ControlSend("horizons", "", Send("{8 down}"), "")

But it doesnt send it to Horizons, it still sends it to everywhere

Edited by RippaN

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  
Followers 0