AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

send keys to a particular window

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
GreatKent



Joined: 05 Oct 2004
Posts: 20

PostPosted: Thu Apr 21, 2005 9:55 pm    Post subject: send keys to a particular window Reply with quote

Hi everyone,

it seems using Send command to send Keys to a particular window fails pretty easily coz that window may go NotActive occassionally. Is there way to make sure the keys can be successfully sent to a particular window?
Thx! Very Happy
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Thu Apr 21, 2005 10:21 pm    Post subject: Reply with quote

Code:
WinActivate, Untitled - Notepad
Send, This is a test`n

or
Code:
ControlSend, Edit1, This is a another test`n, Untitled - Notepad
Back to top
GreatKent



Joined: 05 Oct 2004
Posts: 20

PostPosted: Fri Apr 22, 2005 12:55 am    Post subject: Reply with quote

from the WindowSpy, the ahk_class for a Notepad editor is : "Notepad"
but if I replace "Edit1" with "Notepad", the script doesn't work. Do you know why? and what does "Edit1" actually mean?
Thanks a lot Very Happy


BoBo wrote:
Code:
WinActivate, Untitled - Notepad
Send, This is a test`n

or
Code:
ControlSend, Edit1, This is a another test`n, Untitled - Notepad
Back to top
View user's profile Send private message
BoBo
Guest





PostPosted: Fri Apr 22, 2005 6:29 am    Post subject: Reply with quote

Quote:
ControlSend / ControlSendRaw
--------------------------------------------------------------------------------
Sends simulated keystrokes to a window or control.

ControlSend [, Control, Keys, WinTitle, WinText, ExcludeTitle, ExcludeText]

Note: ControlSendRaw uses the same parameters.

Ergo ...
Quote:
ControlSend, Edit1, This is a another test`n, Untitled - Notepad

In this case the Edit field/area of Notepad is labled/named Edit1.
Window spy shows:
Now Under Mouse Cursor: Edit1
Window Title & Class: Untitled - Notepad

The text you send to the Edit area of Notepad: This is a another test
Back to top
GreatKent



Joined: 05 Oct 2004
Posts: 20

PostPosted: Sat Apr 23, 2005 12:09 am    Post subject: Reply with quote

oh ic, thanks a lot for your crystal clear explanation Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group