Sign in to follow this  
Followers 0
armoros

Some help for this Script ?

5 posts in this topic

#1 ·  Posted (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 you

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

And something else when i copy this in SCITE it saws this character , is this obfuscated by the author ?

post-71357-0-47585000-1336210192_thumb.p the red FF in the end

Edited by armoros

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

Share this post


Link to post
Share on other sites



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

Share this post


Link to post
Share on other sites

#3 ·  Posted (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

#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 by armoros

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by sponk

Share this post


Link to post
Share on other sites

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 ;)

Thanks for ur help too mate..

I learned something from ur post too..

Thank you guys


[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