Guest chiphead Posted May 3, 2004 Share Posted May 3, 2004 (edited) Howdy, is there a way to send keystrokes to a NOT activated window? From AutoIt: Send Sends simulated keystrokes to the active window. Send ( "keys" [, flag] ) So, send seems only to work with activated window? Edited May 3, 2004 by chiphead Link to comment Share on other sites More sharing options...
Helge Posted May 3, 2004 Share Posted May 3, 2004 Check out ControlSend !Good luck and happy scripting ! Link to comment Share on other sites More sharing options...
Guest chiphead Posted May 3, 2004 Share Posted May 3, 2004 hm i cant get it to work properly here is the codeSleep(2000) $Schlafen = 0 $i = 0 $x = 1000 $a = 50 Do $Zufall = Int(Random(700)+1) ;Send("1") ControlSend("", "", "OpWindow1", "1") $Schlafen = $x + $Zufall Sleep($Schlafen) $i = $i + 1 If $i = $a Then MsgBox(4096, "Ergebnis", "Anzahl der Durchläufe: " & $i) EndIf Until $i = $aWhen the Opera browser window is activated the ControlSend works. But as soon as i activate an other window, the script stops. After reactivating the opera window it continues to work. Why? Link to comment Share on other sites More sharing options...
trids Posted May 3, 2004 Share Posted May 3, 2004 Try providing the "title" argument for the ControlSend function. There is an example in the helpfile which uses Notepad to illustrate.HTH Link to comment Share on other sites More sharing options...
trids Posted May 3, 2004 Share Posted May 3, 2004 LOL! Lightning Larry beat me to the draw! Link to comment Share on other sites More sharing options...
Guest chiphead Posted May 3, 2004 Share Posted May 3, 2004 Specify the window title...ControlSend("Some Opera Title Here", "", "OpWindow1", "1")Lar.Opera changes the titel on websites. eg. when im at lycos.com its titel is 'Welcome to Lycos! - Opera', at google.com its 'Google - Opera' and so on... Without a titel parameter in ControlSend AutoIt runs through all browser-tabs. After adding the title to ControlSend it only runs only through the browser-tabs with this special titel. But this titel thing does not change the problem. It still does not work when opera-window is not activated. Link to comment Share on other sites More sharing options...
ezzetabi Posted May 3, 2004 Share Posted May 3, 2004 Usually I would answer something like "Read the fucking help file", but since you are a Opera user and like me you walk in the light I'll help you AutoItSetOption ( "WinTitleMatchMode", 2) and as title use "- Opera" Or AutoItSetOption ( "WinTitleMatchMode", 4) and as title use "Classname:OperaWindow" (untested) Link to comment Share on other sites More sharing options...
Guest chiphead Posted May 3, 2004 Share Posted May 3, 2004 Thanks, it runs now through all tabs but the script still stops when operabrowser is not the active window. hm is it a system specific 'bug' ? I have Windows XP Pro..modified code:AutoItSetOption ( "WinTitleMatchMode", 2)Sleep(2000)$Schlafen = 0$i = 0$x = 1000$a = 50Do $Zufall = Int(Random(700)+1) ;Send("1") ControlSend("- Opera", "", "OpWindow1", "1") $Schlafen = $x + $Zufall Sleep($Schlafen) $i = $i + 1 If $i = $a Then MsgBox(4096, "Ergebnis", "Anzahl der Durchläufe: " & $i) EndIfUntil $i = $a Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now