Sign in to follow this  
Followers 0
armoros

2 Scripts in 1 Gui problem-Help

3 posts in this topic

#1 ·  Posted (edited)

I know i am a help leecher..

But i need your enlightenment...I combined 2 scripts in same gui but it runs only the first

when i put them in the same func works both for the first time but then only the first as the script saws..

What is wrong ?

Thanks for any help

#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, "Edit1")
Local $Input1 = GUICtrlCreateInput("Input1", 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 ###
net_properties()
Func net_properties()
Local $rslt,$out
While 1
   $msg = GUIGetMsg()
   Select
    Case $msg = $GUI_EVENT_CLOSE
     ExitLoop
    Case $msg = $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 $msg = $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 $msg = $Button4
     GUICtrlSetData($edit1,"")
   EndSelect
WEnd
EndFunc

;----> Create dummy keys for accelerators
$hENTER = GUICtrlCreateDummy()
Dim $AccelKeys[1][2] = [["{ENTER}", $hENTER]] ; Set accelerators
GUISetAccelerators($AccelKeys)
;<----
While 1
        Switch GUIGetMsg()
                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 = ""
                        ;<----
        EndSwitch
WEnd

The script is about a cmd

Edited by armoros

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

Share this post


Link to post
Share on other sites



#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, "Edit1")
Local $Input1 = GUICtrlCreateInput("Input1", 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


Teamspeak 3 User Viewer - Quick and functional TS3 Query script, which shows online users.Cached Screenshot Deleter - Deletes older Fraps Screenshots if they exceed a specified limit.Unresolved Topics:Intercept and modify dragdrop text behaviour in scite

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

[autoit]

No words my friend THANK YOU very much..... :)

qsek you are ;)

I see now my mistakes..

Edited by armoros

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

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  
Followers 0