Jump to content

Recommended Posts

Guest chiphead
Posted (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 by chiphead
Guest chiphead
Posted

hm i cant get it to work properly :D

here is the code

Sleep(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 = $a

When 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?

Posted

Try providing the "title" argument for the ControlSend function. There is an example in the helpfile which uses Notepad to illustrate.

HTH :D

Guest chiphead
Posted

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.

Posted

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)

Guest chiphead
Posted

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 = 50

Do

$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)

EndIf

Until $i = $a

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
×
×
  • Create New...