Jump to content

controlsend


Recommended Posts

i am using control send to press enter continuously on a application, and i wondering if its possible to use it on 2 application with the same title

for example: pressing enter on 2 notepad opened with the same name.

thanks

Link to comment
Share on other sites

i am using control send to press enter continuously on a application, and i wondering if its possible to use it on 2 application with the same title

for example: pressing enter on 2 notepad opened with the same name.

thanks

Try this example. There are 2 notepad windows and in everyone is send enter key. Press esc to quit.

AutoItSetOption("WinTitleMatchMode",2)
HotKeySet("{ESC}","Quit");PRESS ESC KEY TO QUIT
Run("notepad.exe")
Run("notepad.exe")

While 1
    $LIST = WinList("Notepad")
    If IsArray($LIST) Then
        For $INDEX = 1 To $LIST[0][0]
            ControlSend($LIST[$INDEX][1],"","Edit1","{ENTER}")
        Next
    EndIf
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc

When the words fail... music speaks.

Link to comment
Share on other sites

Try this example. There are 2 notepad windows and in everyone is send enter key. Press esc to quit.

AutoItSetOption("WinTitleMatchMode",2)
HotKeySet("{ESC}","Quit");PRESS ESC KEY TO QUIT
Run("notepad.exe")
Run("notepad.exe")

While 1
    $LIST = WinList("Notepad")
    If IsArray($LIST) Then
        For $INDEX = 1 To $LIST[0][0]
            ControlSend($LIST[$INDEX][1],"","Edit1","{ENTER}")
        Next
    EndIf
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc
yup its working, is it possible to make it press enter at diferent time?

like 1 press enter every 5sec and the other every 7sec

i changed it slightly so it goes with what im trying to do

AutoItSetOption("WinTitleMatchMode",2)
HotKeySet("{ESC}","Quit");PRESS ESC KEY TO QUIT
ShellExecute("C:\Users\Gamer\Desktop\Xtreme\Loade.exe")
ShellExecute("C:\Users\Gamer\Desktop\Xtreme\Loade.exe")
WinWaitActive ( "SS_Client" )
WinWaitActive ( "SS_Client" )
sleep ( 5000 )

While 1
    $LIST = WinList("SS_Client")
    If IsArray($LIST) Then
        For $INDEX = 1 To $LIST[0][0]
            ControlSend($LIST[$INDEX][1],"","Edit1","{ENTER}")
        Next
    EndIf
    Sleep(100)
WEnd

Func Quit()
    Exit
EndFunc

and im not sure by putting winwaitactive twice would wait for both to load before it continues

thanks

Edited by XTensionX
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...