Jump to content
Sign in to follow this  
MaXiMiUS

Send Functionality

Recommended Posts

MaXiMiUS

Does anybody know of a way to send keypresses to non-active windows? My script works, but it's a bit annoying, taking focus roughly every 5 minutes, minimizing whatever I was doing.

Here's an example. I wish I could remove the BlockInput and WinActivate parts, though currently, it doesn't work properly without them. If I remove the BlockInput and click something, that window loses focus, and everything that was being sent goes into the wrong window. In this case, I'm not certain the WinActivate was needed, but I kept it there for consistancy.

BlockInput(1);We don't want user input mixing with the script
        $begin2 = TimerInit()
        Run("TELNET 127.0.0.1 8888", "C:\WINDOWS\system32\", @SW_HIDE)
        Sleep(2048);Delay, allow program to exit if connection fails
        $nocrash = WinExists("Telnet 127.0.0.1");Check if this was successful
        $mem = MemGetStats()
        If $nocrash = 0 Or $mem[0] > 40 Then
            $nocrash = 0
            Announce("", 1)
        EndIf
        WinActivate("Telnet 127.0.0.1");This must be active to recieve input
        Send("password{Enter}exit{Enter}")
        ProcessClose("telnet.exe")
        BlockInput(0)

What I'd like to be able to do is:

Send("password{Enter}exit{Enter}", "Telnet 127.0.0.1")

Let me know if I've overlooked anything.

Edited by MaXiMiUS

Share this post


Link to post
Share on other sites
Lapo

Edit :

ahhh search and download telsend :

http://xoomer.alice.it/dfs_oe/telnet.htm

http://translate.google.com/translate_t?langpair=it|en

search Controlsend in the help file >> C:\PROGRA~1\AUTOIT3\AUTOIT.CHM

Run("notepad.exe")

;Run("notepad.exe","", 3)

sleep(500)

AutoItSetOption("WinTitleMatchMode", 4)

WinWaitActive( "Untitled - Notepad", "", 5 )

ControlFocus ( "Untitled - Notepad","" , "Scarica" )

Controlsend ( "Untitled - Notepad", "" , "Edit1","left" )

Edited by Lapo

Share this post


Link to post
Share on other sites
SmOke_N

Try

ControlSend('Window Title', '', '', 'password etc...)


Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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.