Powershell GUI fronted (WPF) to run categorized console scripts

⌈⌋ ⎇ branch:  ClickyColoury


Artifact [c47ac20d0c]

Artifact c47ac20d0c5e1affc7c715dea350312ab47f0755:

  • File contrib/MakeNewPlugin.ps1 — part of check-in [48e6e20fbb] at 2018-05-16 18:11:20 on branch trunk — Template tool to craft/prepare new user scripts. (user: mario size: 1773)

# encoding: utf-8
# api: clicky
# type: inline
# version: 0.1
# title: Make new plugin
# description: Prepares comment stub for new plugin (in user %APPDATA dir)
# category: extras
# vars:
#    { name: title, type: str, value: "my test plugin", description: Tool title }
#    { name: description, type: str, value: "...", description: Short summary }
#    { name: category, type: select, select: "network|info|beta|powershell|cmd|user|wmi|extras", value: "beta", description: menu/grouping class }
#    { name: version, type: str, value: "0.1", description: Current version }
#    { name: icon, type: select, select: "powershell|user|users|wmi|notes|folder|date|cloud|fire|info|log|office|printer|tools", description: "menu icon (any existing img/* shorthand could be used)" }
#    { name: code, type: text, value: "Get-ADUser $username", description: "Any actual code goes here" }
# icon: notes
# state: beta
#
# Very crude tool to make a new tool/plugin script.
#


# prepare
$fn = "new-"+($title -replace "\W+","-")+".ps1"
$src = @"
# encoding: utf-8
# api: clicky
# title: $title
# description: $description
# version: $version
# category: $category
# type: inline
# state: beta
# icon: $icon
# key:
# config: -
# vars: -
# hidden: 0
# x-generated-from: MakeNewPlugin.ps1
#
# $description.
# → MORE DOCUMENTATION SHOULD GO HERE. WE KNOW WHERE YOU WORK!!
#

Param(
    `$machine = (Read-Host "machine"),      # The Param() stub allows the script to work standalone too.
    `$username = (Read-Host "username")     # Both `$machine and `$username vars were predefined anyway.
)

# do the things
$code

"@


# write
$fn = $env:APPDATA+"\multitool\$fn"
$src | Out-File $fn -Encoding UTF8 -Append
notepad $fn