mentosan Posted June 20, 2008 Share Posted June 20, 2008 Hello guys I have created an au3 script which makes a telnet session and executes some commands every 20 seconds. The problem is, if during the execution of this script, I'm opening for example Notepad, when the delay (of 20 secs) occurs, it will write the commands in this active window - Notepad. How can I avoid this ? I mean which function or code shall I use in order to make the commands from the script to be only effective in the telnet window no matter if meanwhile I'm having another active window. Thank you for your answer. Link to comment Share on other sites More sharing options...
LongBowNZ Posted June 20, 2008 Share Posted June 20, 2008 ControlSend() Link to comment Share on other sites More sharing options...
mentosan Posted June 23, 2008 Author Share Posted June 23, 2008 But with ControlSend() you cannot send keys, only strings. I need to send keys in my telnet window. Link to comment Share on other sites More sharing options...
Kiti Posted June 23, 2008 Share Posted June 23, 2008 Hello guysI have created an au3 script which makes a telnet session and executes some commands every 20 seconds. The problem is, if during the execution of this script, I'm opening for example Notepad, when the delay (of 20 secs) occurs, it will write the commands in this active window - Notepad. How can I avoid this ? I mean which function or code shall I use in order to make the commands from the script to be only effective in the telnet window no matter if meanwhile I'm having another active window.Thank you for your answer.WinActivate("The name of your window")WinWaitActive("Same as above")This activates your telnet window, waits a few miliseconds until it's active and then do continue to the next part of your script. Think outside the box.My Cool Lego Technic Website -- see walking bipeds and much more!My YouTube account -- see cool physics experimentsMy scripts:Minesweeper bot: Solves advanced level in 1 second (no registry edit), very improved GUI, 4 solving stylesCan't go to the toilet because of your kids closing your unsaved important work? - Make a specific window uncloseableCock Shooter Bot -- 30 headshots out of 30 Link to comment Share on other sites More sharing options...
LongBowNZ Posted June 23, 2008 Share Posted June 23, 2008 ControlSend works in a similar way to Send but it can send key strokes directly to a window/control, rather than just to the active window. Link to comment Share on other sites More sharing options...
TomZ Posted June 23, 2008 Share Posted June 23, 2008 What about using the TCP-commands instead of telnet? That way you don't need to rely on external applications and you will be able to leave it running while using the computer. Link to comment Share on other sites More sharing options...
newbiescripter Posted June 23, 2008 Share Posted June 23, 2008 (edited) But with ControlSend() you cannot send keys, only strings. I need to send keys in my telnet window. Controlsend() works like Send() so yes you can send keys.. just look in the help file under send() and you will see how to do it. here is an example: Run("notepad.exe") Sleep(5000) Send("F5"); send as a string Send("{ENTER}"); send the key Enter Send("{F5}"); send as the key F5 Regards Edited June 23, 2008 by newbiescripter Link to comment Share on other sites More sharing options...
TurionAltec Posted June 23, 2008 Share Posted June 23, 2008 Run telnet and use StdinWrite() and StdoutRead() to send /receive text from it. Look at the examples for either function to see how to hook up STDIO from run to these functions. Or as someone else mentioned try using the TCP functions directly. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now