Jump to content

ASCII-cmd command-Is that a problem ?


Recommended Posts

I didnt know what title to put..

I have a gui and using stdout with commands, all commands run ok etc.

but when i try the Stars war movie command nothing happens..

Could be the problem the ASCII ?

Not a big proplem but i just wonder..

this is the command [ telnet towel.blinkenlights.nl. ]

#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <StaticConstants.au3>
Local $vDos, $sline = ""
#region ### START Koda GUI section ### Form=
Local $Form1 = GUICreate("Form1", 585, 623, 211, 115)
Local $Edit1 = GUICtrlCreateEdit("", 0, 24, 577, 257)
GUICtrlSetData(-1, "")
Local $Input1 = GUICtrlCreateInput("", 24, 296, 209, 21)
Local $Button1 = GUICtrlCreateButton("run", 248, 296, 75, 25)
Local $Button2 = GUICtrlCreateButton("ipconfig", 40, 456, 75, 25)
Local $Button3 = GUICtrlCreateButton("netstat", 128, 456, 75, 25)
Local $Button4 = GUICtrlCreateButton("clear", 320, 456, 75, 25)
GUICtrlCreateLabel("parm", 96, 400, 75, 17)
Local $parm = GUICtrlCreateEdit("$parm", 176, 392, 81, 33, $ss_sunken)
GUICtrlSetData(-1, "Edit2")
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
;----> Create dummy keys for accelerators
$hENTER = GUICtrlCreateDummy()
Dim $AccelKeys[1][2] = [["{ENTER}", $hENTER]] ; Set accelerators
GUISetAccelerators($AccelKeys)
;<----
net_properties()
Func net_properties()
    Local $rslt, $out
    While 1
        $msg = GUIGetMsg()
        Switch $msg
            Case  $GUI_EVENT_CLOSE
                Exit
            Case $Button1, $hENTER
                $vDos = Run(@ComSpec & " /c " & GUICtrlRead($Input1), @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
                While 1
                    $sline &= StdoutRead($vDos)
                    If @error Then ExitLoop
                WEnd
                GUICtrlSetData($Edit1, $sline & @CRLF)
                GUICtrlSetData($Input1, "")
                ;----> Reset
                $sline = ""
                ;<----
            Case $Button2
                $rslt = Run(@ComSpec & " /c ipconfig " & GUICtrlRead($parm), @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
                While 1
                    $out = StdoutRead($rslt)
                    If @error Then ExitLoop
                    GUICtrlSetData($Edit1, $out & @LF, 1)
                WEnd
            Case $Button3
                $rslt = Run(@ComSpec & " /c netstat " & GUICtrlRead($parm), @SystemDir, @SW_HIDE, $STDERR_MERGED + $STDOUT_CHILD)
                While 1
                    $out = StdoutRead($rslt)
                    If @error Then ExitLoop
                    GUICtrlSetData($Edit1, $out & @LF, 1)
                WEnd
            Case $Button4
                GUICtrlSetData($Edit1, "")
        EndSwitch
    WEnd
EndFunc   ;==>net_properties

[font="verdana, geneva, sans-serif"] [/font]

Link to comment
Share on other sites

;) Greetings here. You should try using shellexecute() instead of Run(). Check if this works for you.

----------------------------------------

:bye: Hey there, was I helpful?

----------------------------------------

My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1

Link to comment
Share on other sites

;) Greetings here. You should try using shellexecute() instead of Run(). Check if this works for you.

Not a solution. He's using StdInRead, which uses the PID which is returned by the Run() function.

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]
Link to comment
Share on other sites

;) Greetings here. You should try using shellexecute() instead of Run(). Check if this works for you.

Yes i tried this too..no luck

Not a solution. He's using StdInRead, which uses the PID which is returned by the Run() function.

Yeah probably that is cant use shellexecute()..

Thank you both guys..

[font="verdana, geneva, sans-serif"] [/font]

Link to comment
Share on other sites

Are you using Vista or above? Is Telnet installed on the computer you're trying it on? Because by default, Vista+ doesn't have telnet installed on it.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Sorry BrewManNH i was out....

I use XP-sp3 in my pc and i can run this command with cmd.exe.

But not from Autoit..and as i test more commands i cand either run [ nbtstat ].. ;) ( witch i can run with with cmd.exe)

If that makes sense should i put a func in the script that manipulates telnet or something ?

Thanks again for your time...

Edited by armoros

[font="verdana, geneva, sans-serif"] [/font]

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...