Jump to content

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


Recommended Posts

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]

Link to post
Share on other sites

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 (NEW 2021-06-05 - Version 1.5.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (NEW 2021-06-14 - Version 1.6.5.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (NEW 2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...