Sign in to follow this  
Followers 0
brodie28

Sending keystrokes to a window

11 posts in this topic

How is it done?

I want to have this window minimised while autoit sends keystrokes into it. There are no controls or anything....

Share this post


Link to post
Share on other sites



I don't think it possible with AutoIt's built in functions. If there are no controls, why do you want to send keystrokes to it? A screenshot of the window may help.

Hallman

Share this post


Link to post
Share on other sites

What I mean is the autoit window info tool doesnt detect any controls.

Share this post


Link to post
Share on other sites

Well then I don't think it's possible with AutoIt's current functions. Anyone correct me if I'm wrong.

Hallman

Share this post


Link to post
Share on other sites

ControlSend("Untitled", "", "Edit1", "This is a line of text in the notepad window")


Share this post


Link to post
Share on other sites

Control send wont work ... as there is no standard windows control to send it to.

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

What I mean is the autoit window info tool doesnt detect any controls.

AutoIt Forum members detect a lack of information. :)

Edit:

@Hallman, A window is one big control in itself.

Edited by MHz

Share this post


Link to post
Share on other sites

care to give an example of what he's trying to send this text to?


Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

@Hallman, A window is one big control in itself.

Well, in that case, what do you use as a control ID? I did a test with notepad and using the notepad window handel as the control ID but it didn't work ...

Edited by Hallman

Share this post


Link to post
Share on other sites

Well, in that case, what do you use as a control ID? I did a test with notepad and using the notepad window handel as the control ID but it didn't work ...

I believe the logic is that Notepad does have controls, notably "Edit1". If you set no ControlID, such as "", then there is nowhere on Notepad to ControlSend the string. A cmd prompt in comparison has no ControlID's to use other then the window itself, so ControlSend will send the string to the window (control).

; Title may vary dependant on system
$title = 'C:\WINDOWS'

Run('CMD')
WinWait($title)
ControlSend($title, '', '', 'string of text')

Share this post


Link to post
Share on other sites

Worked.

Thanks alot.

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