Jump to content
Sign in to follow this  

ControlSend is messing up textual casing Aa _- "2 in a telnet window

Recommended Posts


DllCall("kernel32.dll", "int", "Wow64DisableWow64FsRedirection", "int", 1)
$hTelnet = Run('c:\windows\system32\telnet.exe 10011', '', @SW_SHOW)
DllCall("kernel32.dll", "int", "Wow64EnableWow64FsRedirection", "int", 1)
ControlSend('Telnet', '', '', 'use port=9987' & @CRLF, 1)
ControlSend('Telnet', '', '', 'clientupdate client_nickname="Tester' & Random(1, 1234567, 1) & '"' & @CRLF, 1)
ControlSend('Telnet', '', '', 'whoami' & @CRLF, 1)

Updated at the bottom to reflect my more rounded down issue. It isn't that telnet is not sending more than 1 command it is sending all commands but messing up case, which is why the first command was fine because everything was lowercase.

Here is the background on what I am trying to do. If you download the free TeamSpeak 3  server and connect to it with a client you can make a bookmark to and show query clients. Once connected  via the bookmark you can then telnet to port 10011 and type commands.

Once the initial telnet connection is established I set it to communicate with the correct virtualserver port which is 9987 by default. Then I try and do something simple such as change the name it appears as in the list when you are viewing query clients.

The problem? Running the compiled exe via a scheduled task, for some reason it only types the initial command to connect to the virtual server port running on 9987 but it will not type any further commands, as you would see if you did this test the username is your own local IP address rather than the name of "Tester 902"

The script works fine when executed manually yet only gets to perform 1 telnet command and then fails for all others?

Anyone have any ideas on this? I need it to be hidden yet still type the needed commands. I do not get into way over the top complicated things like manually doing network connections, sending and receiving network commands via autoit or convoluted winAPI things yet I don't want a simple "keep it on the screen, block inputs while I click and type" because then you have to stop what you are doing when it happens. Ideally I would like to use a tweaked/fixed version of this script. While I am open to other possibilities to perform these actions I only use something if I fully understand what ever it is in it's entirety. I never use external user defined functions if I do not understand parts of it because if it were to ever break down with a new version of autoit and the UDF was unsupported I couldn't fix it myself. So I am just trying to automate telnet since telnet does all the connection things that I need and so should be able to just automate that to get the job done via a scheduled task, hidden off screen. I tried to use STDIN for a command line alternative to telnet called Plink but I can never actually even manually type into the box once it connects, let alone automate typing in the box. So it seems standard Telnet is my best bet.

Additional information before submitting:

I have done some testing and updated the script. The issue is it seems focus of other windows while it is sending direct to the correct control is leading it to be missing the {SHIFT} aspects of the string to be sent to the control. I say "Tester" and it says 2tester2 or Something_Here and it sends instead something-here

Any ideas? I think this may be a legitimate bug since it is sending strings, it just many times due to lack of focus loses the uppercase characters and thus is sending lowercase whether letters or symbols. You know what I mean.


I have tried compiling as both 86 and 64 format and it doesn't change the fact that running normally, manually and clicking off the window at varying levels of speed upon telnet loading causes the case to be lost, thus making incorrect symbols and text casing. Also the problem exists every time when running the compiled script as a scheduled task.

Edited by Morthawt

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  

  • Similar Content

    • qsek
      By qsek
      Im not sure if this is intended but normally Autoit variables are always passed as copies (except objects i think).
      But below i observed an unconsistency when copying maps with nested maps inside.
      If you create a nested map1 and copy it to a new map2, changing a nested value in map2 will also change the nested value in map1
      Dim $player[] Dim $sub[] $player.test1 = 1 $player.test2 = $sub $player.test2.child1 = "org" $player.test2.childext = $sub $player.test2.childext.child1 = "org2" $playerold = $player ; make a copy of the whole map ConsoleWrite("player.test2.child1 : "& $player.test2.child1 & @CRLF); original nested value in $player $playerold.test2.child1 = "changed" ; edit a nested value in $playerold ConsoleWrite("player.test2.child1 : "& $player.test2.child1 & @CRLF) ; original nested value in $player changed ConsoleWrite("---------------------" & @CRLF) ConsoleWrite("player.test2.childext.child1 : "& $player.test2.childext.child1 & @CRLF); original level2 nested value in $player $playerold.test2.childext.child1 = "changed2" ; edit a level2 nested value in $playerold ConsoleWrite("player.test2.child1 : "& $player.test2.child1 & @CRLF); original level1 nested value in $player stayed the same ConsoleWrite("player.test2.childext.child1 : "& $player.test2.childext.child1 & @CRLF); original level2 nested value in $player changed  
    • BetaLeaf
      By BetaLeaf
      As the title says, when a script that is stored on a Google Drive File Stream drive is ran or compiled, it fails to work at all.
      Basically, Google Drive File Stream creates a G:\ drive where you can access all your files. The difference between this and Google Backup and Sync is your files are downloaded as needed rather than they always be downloaded and taking up storage. 
      How to Reproduce Bug
      1. Download and Install Google Drive File Stream
      2. Sign into Google Drive File Stream with a G Suite account. 
      3. Create a AutoIt Script and save it to Google Drive File Stream. (See attached file)
      4. Attempt to run or compile this AutoIt Script. 
      AutoIt appears to act like the script is (incorrectly) empty and ends immediately. (You can kind of tell based on file sizes from a successful and failed compile).
      I've also attached a Process Monitor log file. Hopefully someone can figure this out, because having to move the script out of the drive just to run or compile it is super annoying and I lose version revisioning Google Drive provides me.
    • Byte11
      By Byte11
      WinSetState ("[CLASS:OpusApp]", "", @SW_SHOWMAXIMIZED) and WinSetState ("[CLASS:OpusApp]", "", @SW_MAXIMIZE) don't maximize the window.  Using WinSetState("[CLASS:OpusApp]","",@SW_RESTORE) allows me to maximize it about 15% of the time. I've tried using  WinMove("[active]",0,0,@Desktopwidth,@Desktopheight), but that only makes it worse. I've also tried putting in a sleep and maximizing it again. Does anyone have a solution?
      Here's my code:
      The startup script is intentionally commented, because I'm not testing it right now. The other comment is just for debugging when I need it. 
      UPDATE: When I run two instances of the program, it works almost all the time, but if I copy the code inside the else statement twice it doesn't work at all (despite the fact that it's running the same code just in one program vs two). I also noticed that when I run two instances of it, about 50% of the time when it opens both the windows, it also hits the windows button and types the letter d into the search box. Neither of these actions are in my code. I'm not really sure what's going on. 
    • distancesprinter
      By distancesprinter
      _ArrayDisplay($aArray, "Window Title", "1:", 0, Default, "Column") ; Expected results are rows 1 to the end of the array, all columns. The result is rows 0-1, all columns. The API reference is here:
      Am I doing something wrong?
    • imitto
      By imitto
      I just playing around with _ArrayMin for my next project, but seems like it's not working. I think the code is OK, but I always get the value of $aArray[2][1], not col 2's lowest value (see attached image)