Jump to content

Dual Programm and ControlSend


Recommended Posts

2 NotepadProgramm(A and :whistle: run at the same time. Bothe are same in Titel, Text and Control ID. My wish is : When i typ one key in A, this key are typed in B.

I try to code with ControlSend, but its not ok because Both are same in Titel, Control Id. Can anyone help me ?

Link to comment
Share on other sites

but its not ok because Both are same in Titel, Control Id. Can anyone help me ?

Use the Window handle. Get it immediately after the program runs

Run("notepad.exe")
WinWaitActive("")
$window1 = WinGetHandle("")
WinMove($window1, "", 100, 100, 300, 200)

Run("notepad.exe")
WinWaitActive("")
$window2 = WinGetHandle("")
WinMove($window2, "", 500, 300, 300, 200)


ControlSend($window1, "", "Edit1", "Test #1")

ControlSend($window2, "", "Edit1", "Test #2")

ControlSend($window1, "", "Edit1", @CRLF & "Test #1... again")

8)

NEWHeader1.png

Link to comment
Share on other sites

My wish is : When i type A in Windows1, A ist typed automatisch in Windows2.

#include <misc.au3>

Run("notepad.exe")

WinWaitActive("")

$window1 = WinGetHandle("")

Run("notepad.exe")

WinWaitActive("")

$window2 = WinGetHandle("")

Func _IsAnyKeyPressed($start = 0, $end = 255)

For $i = $start to $end

if (_IsPressed(Hex($i))) Then return $i

Next

return -1

EndFunc

while(true)

Local $val

$val = _IsAnyKeyPressed()

if ( $val > -1 ) Then

ControlSend($window2,"","Edit",Chr($val))

EndIf

WEnd

But isnt successful

Link to comment
Share on other sites

maybe easier

Dim $text, $text_hold

Run("notepad.exe")
WinWaitActive("")
$window1 = WinGetHandle("")
WinMove($window1, "", 100, 100, 300, 200)

Run("notepad.exe")
WinWaitActive("")
$window2 = WinGetHandle("")
WinMove($window2, "", 500, 300, 300, 200)


While 1
    $text = WinGetText($window2)
    If $text <> $text_hold Then
    ControlSetText($window1, "", "Edit1", $text)
    $text_hold = $text
    EndIf
    sleep(50)
WEnd

I dont like "key loggers"

8)

NEWHeader1.png

Link to comment
Share on other sites

maybe easier

Dim $text, $text_hold

Run("notepad.exe")
WinWaitActive("")
$window1 = WinGetHandle("")
WinMove($window1, "", 100, 100, 300, 200)

Run("notepad.exe")
WinWaitActive("")
$window2 = WinGetHandle("")
WinMove($window2, "", 500, 300, 300, 200)
While 1
    $text = WinGetText($window2)
    If $text <> $text_hold Then
    ControlSetText($window1, "", "Edit1", $text)
    $text_hold = $text
    EndIf
    sleep(50)
WEnd

I dont like "key loggers"

8)

No, i am not key logger. i want to test how can person use controlsend to control 2 same programm at the same time.

Also, i want to code one programm for mmorpg. I have 2 account, I control one and the Bot control the other. The Bot follow me always.

Have you any Idea for this Problem ? Many thank

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...