Jump to content
Sign in to follow this  
armoros

School me on this---$xWin= @DesktopWidth * .5......

Recommended Posts

armoros

If some one could explain to me what this exactly does and why when i try to insert it in Koda it says there is a fault...

i mean the $xwin--$ywin=.....

#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()

This is the complete script..

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

Looks like Koda needs absolute values for position and size.

All those calculations are beeing done to make the script work independant of screen resolution.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
armoros

Thank you very much Water for the explanation...


[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  

×