Sign in to follow this  
Followers 0
cranzy

Control Send

12 posts in this topic

Hey guys I'm new with AutoIt, but not new with the programming. I was wondering if someone can tell me what's the 3rd parameter of the ControlSend() function, ControlID. I simply want to send keystrokes to a game, but I really don't know the ControlId of the game ? Thank you for your help in advance !

-cranzy

Share this post


Link to post
Share on other sites



leave autoit running. program the following

Send({f1})
sleep(100)
send(send)
sleep(100)
send({enter})

Share this post


Link to post
Share on other sites

..what's the 3rd parameter of the ControlSend() function, ControlID..

Controls

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

Share this post


Link to post
Share on other sites

With ControlSend/Click/etc you are telling the script to target a specific control. The third option tell it exactly WHAT control you want it to interact with. This can be done a number of ways but it is really good if you do look at the tutorials or help for examples.

If you need to find the ControlID of an element use the AutoIt Window Info Tool and then hover over or drag the crosshairs onto the element (like a button) and then you can get the controlID number for that element. Careful though. Some windows randomly generate the ControlID number so using a hard coded value may not work. You may need to look into advanced options.

Share this post


Link to post
Share on other sites

Well HalH is closest to helping me. I know what the 3rd parameters is but I cannot find it with AutoIt Window Info. The game is Silkroad, the task is simple, ControlSend() some random text to the chat. There isn't anything like a button or something to type text. It's just you press Enter then the text and then Enter again to send the text. Any ideas? Can I skip the ControlID or that won't work ?

-cranzy

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Not to be snide cranzy but did you even LOOK in the help file? You can send the enter key easy. Its "{enter}". And to send a string with it simply do

Send("{enter}Howdie Pardners. You goin' on the silkroad?{enter}")
. Take a look at the help for send and it will get you going. You can send just about any key on a keyboard. Take a look at the help files. Really. They are where I get most of my info from.

Edit: DUDE! (sorry more snide here) look at Altometers post. He actually DID the enter key in his little script. You can use ControlSend to target the window Silkroad is running in or use Send if you are doing an AFK but the window is focused. Targeting the game itself inside the window may be hard.

Edited by HalH

Share this post


Link to post
Share on other sites

Yea, I'm trying to do a ControlSend() when the Window isn't active.

Share this post


Link to post
Share on other sites

Yea, I'm trying to do a ControlSend() when the Window isn't active.

Basically the ControlID is only useful when you can find something like the CLASS of a window. Such as the EDIT controlID in notepad. I think it's something like [CLASS:EDIT]. If the game doesn't have a class for the specific place you are trying to send stuff to then you can't send it to that specific place. Plain and simple. If you don't need to send it to a specific place and the game can take keyboard commands for what you are trying to do, then just leave the controlID blank and you will be fine.

Share this post


Link to post
Share on other sites

Thank you Kaeft ! Leaving the ControlID blank really worked ! Cya around !

-cranzy

Share this post


Link to post
Share on other sites

I'm having the same problem. Cranzy, when you wrote the command did you leave the ControlID parameter blank with "" or another way?

Share this post


Link to post
Share on other sites

@Ballad, yes, leave the CID parameter blank with "".


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

Share this post


Link to post
Share on other sites

Thank You, just clarifying.

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