armoros Posted May 5, 2012 Posted May 5, 2012 (edited) My friends i found this script witch outputs cmd commands in the Gui, but the problem is that you got to scroll a lot to see the result of the command, how can we fix this ?If you have the time to test the script you will see what i mean.Thank youexpandcollapse popup#NoTrayIcon Global $output = "" $xWin = @DesktopWidth * .5 $yWin = @DesktopHeight * .5 $gui = GUICreate("CMD Tool",$xWin,$yWin,-1,-1) $inputbox = GUICtrlCreateInput("VER",$xWin * .025,$yWin * .05,$xWin * .875,$yWin * .05) GUICtrlSetFont (-1,9, 400, 0, "Arial") $outputwin = GUICtrlCreateEdit("",$xWin * .025,$yWin * .15,$xWin * .95,$yWin * .8,2048+2097152) GUICtrlSetFont (-1,9, 400, 0, "Lucida Console") $btnGo = GUICtrlCreateButton("GO",$xWin * .925,$yWin * .05,$xWin * .05,$yWin * .05) GUICtrlSetState(-1,512) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop If $msg = $btnGo Then $strCMD = GUICtrlRead($inputbox) $CMD = Run(@Comspec & " /c " & $strCMD,"",@SW_HIDE,6) While 1 $line = StdoutRead($CMD) If @error Then ExitLoop $output &= $line & @CRLF WEnd While 1 $line = StdErrRead($CMD) If @error Then ExitLoop $output &= $line & @CRLF WEnd ProcessClose($CMD) $output &= "---------------------------------------------------------------------------------------" & @CRLF & @CRLF GUICtrlSetData($inputbox,"") If StringInstr($output,"") Then GUICtrlSetData($outputwin,"") $output = "" EndIf GuiCtrlSetData($outputwin,$output) GUICtrlSetState($inputbox,256) GUICtrlSetState($btnGo,512) EndIf WEnd ExitAnd something else when i copy this in SCITE it saws this character , is this obfuscated by the author ? the red FF in the end Edited May 5, 2012 by armoros [font="verdana, geneva, sans-serif"] [/font]
stormbreaker Posted May 5, 2012 Posted May 5, 2012 Try changing your code with something like this: While 1 $line = StdoutRead($CMD) If @error Then ExitLoop If $line = "" then $output &= $line else $output &= $line & @CRLF EndIf WEnd While 1 $line = StdErrRead($CMD) If @error Then ExitLoop If $line = "" then $output &= $line else $output &= $line & @CRLF EndIf WEnd As for FF, try changing the encoding of your AU3 script file. ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1
armoros Posted May 5, 2012 Author Posted May 5, 2012 (edited) Try changing your code with something like this: As for FF, try changing the encoding of your AU3 script file. Yes MKISH that solved the issue..you rock brother As for the FF i changed the encoding but nothing, I just erase it and still the script works, so no harm is done. Thank you my friend expandcollapse popup#NoTrayIcon Global $output = "" $xWin = @DesktopWidth * .5 $yWin = @DesktopHeight * .5 $gui = GUICreate("CMD Tool",$xWin,$yWin,-1,-1) $inputbox = GUICtrlCreateInput("VER",$xWin * .025,$yWin * .05,$xWin * .875,$yWin * .05) GUICtrlSetFont (-1,9, 400, 0, "Arial") $outputwin = GUICtrlCreateEdit("",$xWin * .025,$yWin * .15,$xWin * .95,$yWin * .8,2048+2097152) GUICtrlSetFont (-1,9, 400, 0, "Lucida Console") $btnGo = GUICtrlCreateButton("GO",$xWin * .925,$yWin * .05,$xWin * .05,$yWin * .05) GUICtrlSetState(-1,512) GUISetState() While 1 $msg = GUIGetMsg() If $msg = -3 Then ExitLoop If $msg = $btnGo Then $strCMD = GUICtrlRead($inputbox) $CMD = Run(@Comspec & " /c " & $strCMD,"",@SW_HIDE,6) While 1 $line = StdoutRead($CMD) If @error Then ExitLoop If $line = "" then $output &= $line else $output &= $line & @CRLF EndIf WEnd While 1 $line = StdErrRead($CMD) If @error Then ExitLoop If $line = "" then $output &= $line else $output &= $line & @CRLF EndIf WEnd ProcessClose($CMD) $output &= "---------------------------------------------------------------------------------------" & @CRLF & @CRLF GUICtrlSetData($inputbox,"") If StringInstr($output,"") Then GUICtrlSetData($outputwin,"") $output = "" EndIf GuiCtrlSetData($outputwin,$output) GUICtrlSetState($inputbox,256) GUICtrlSetState($btnGo,512) EndIf WEnd Exit Edited May 5, 2012 by armoros [font="verdana, geneva, sans-serif"] [/font]
sponk Posted May 5, 2012 Posted May 5, 2012 (edited) Dont know if I understood it right, but try search for $SB_SCROLLCARET; this will autoscroll down to the last line in your GUI. Regards edit: Just saw you got help already Edited May 5, 2012 by sponk
armoros Posted May 5, 2012 Author Posted May 5, 2012 Dont know if I understood it right, but try search for $SB_SCROLLCARET; this will autoscroll down to the last line in your GUI.Regardsedit: Just saw you got help already Thanks for ur help too mate..I learned something from ur post too..Thank you guys [font="verdana, geneva, sans-serif"] [/font]
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