Powershell GUI fronted (WPF) to run categorized console scripts

⌈⌋ branch:  ClickyColoury


Artifact [248f5d4842]

Artifact 248f5d484231c747a070c2046233f627fb112855:

  • File contrib/ComputerPingBtn.ps1 — part of check-in [2bf65ee48c] at 2018-05-16 18:10:47 on branch trunk — Enables little ping button - with PS Test-Connection (instead of plain ping) (user: mario size: 1010)

# encoding: utf-8
# api: clicky
# type: init-gui
# version: 0.1
# title: Ping button
# description: enables the little ping button atop hostname field in toolbar
# category: ui
# state: stable
# hidden: 1
# nomenu: 1
#
# Enables the ping icon (right hand) in the machine/hostname toolbar.
#

$GUI.w.findName("BtnComputerPng").add_Click({
    $GUI.machine.Background = "Yellow"

    $m = $GUI.machine.Text
    if ($t = Test-Connection $m -Count 1 -ErrorAction SilentlyContinue -ErrorVariable err) {
        $col="#5599ff99"
    }
    else {
        $col="#55ff7755"
        $t = New-Object PSObject -Prop @{Address=$m;Statuscode=$err.Exception}
    }

    $t = $t | FL Address,BufferSize,NoFragmentation,PrimaryAddressResolutionStatus,ProtocolAddress,ReplyInconsistency,ReplySize,ResponseTime,StatusCode,Timeout,TimeToLive,TypeofService,PSComputerName,IPV4Address,IPV6Address | Out-String
    Out-Gui -F $col -B "#ee070f1f" ($t.trim())

    $GUI.machine.Background = $col
})