Jump to content
Sign in to follow this  
XTensionX

controlsend

Recommended Posts

XTensionX

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

Share this post


Link to post
Share on other sites
Skruge

Yes, you just have to use separate ControlSend calls and differentiate them by handle/instance/class/text.


[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites
Andreik

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

Share this post


Link to post
Share on other sites
XTensionX

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

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.