Jump to content



Photo

2 Scripts in 1 Gui problem-Help


  • Please log in to reply
2 replies to this topic

#1 armoros

armoros

  • Active Members
  • PipPipPipPipPipPip
  • 503 posts

Posted 28 April 2012 - 08:54 PM

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

AutoIt         
#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, 28 April 2012 - 08:58 PM.






#2 qsek

qsek

    Universalist

  • Active Members
  • PipPipPipPipPip
  • 256 posts

Posted 28 April 2012 - 09:13 PM

AutoIt         
#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

#3 armoros

armoros

  • Active Members
  • PipPipPipPipPipPip
  • 503 posts

Posted 28 April 2012 - 09:31 PM

[autoit]

No words my friend THANK YOU very much..... :)
qsek you are ;)

I see now my mistakes..

Edited by armoros, 28 April 2012 - 09:32 PM.





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users