Powershell GUI fronted (WPF) to run categorized console scripts

⌈⌋ branch:  ClickyColoury


Check-in [dafc0b50d4]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Made Usertools base dir configurable
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: dafc0b50d40af13899a3b9b882e8744242b62afe
User & Date: mario 2017-09-24 06:58:35
Context
2017-09-24
06:58
Moved more user-related scripts to... users/ check-in: 2e564262f9 user: mario tags: trunk
06:58
Made Usertools base dir configurable check-in: dafc0b50d4 user: mario tags: trunk
2017-09-23
18:37
Tag release 0.8.0 check-in: d9f41219b0 user: mario tags: trunk, 0.8.0
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tools/plugins/menu_usertools.ps1.

1
2
3
4
5
6
7
8
9
10
11
12
13

14
15



16
17
18
19
20
21
22
23
24
25
26
27
28
# api: multitool
# type: init-gui
# version: 0.5
# title: UserTools
# description: register U:\Tools\UserTools
# hidden: 1
# category: edit
# config: {}
#
# Each entry copies the respective file to the user desktop


if ((!$CLI) -and (!$e) -and ($GUI.w)) {


    $m = $GUI.w.findName("Menu_USERTOOLS").Items




    #-- extract description file
    $desc = Import-CSV ".\data\usertools.description.csv"

    #-- add menu entries
    ForEach ($file in (dir .\UserTools\*.*)) {
        $fn = $file.Name

        #-- MenuItem + Image
        $meta = $desc | ? { $_.file -eq $fn }
        if (!$meta) { $meta = @{icon="icon.copy.png"; desc=""} }
        $ICON = W Image @{Source=(Get-IconPath $meta.icon); Height=18; Width=18}
        $m.Add((W MenuItem @{Header="_$fn"; Tooltip=$meta.desc; Icon=$ICON; Add_click={ copy-UserTool "$fn" }.getnewclosure()}))


|

|


|


|

|
>
|
<
>
>
>





|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# api: multitool
# type: init-gui
# version: 0.6
# title: UserTools
# description: register .\UserTools\
# hidden: 1
# category: edit
# config: { name: cfg.usertools, value: .\UserTools, type: str, description: shortcut source directory }
#
# Each entry copies the respective file to the user desktop
# (Requires `hostname` and `username` to be set.)

if ((!$CLI) -and (!$e) -and ($GUI.w) -and ($m = $GUI.w.findName("Menu_USERTOOLS"))) {
    $m = $m.Items
    

    if (!($cfg.usertools)) {
       $cfg.usertools = ".\UserTools"
    }

    #-- extract description file
    $desc = Import-CSV ".\data\usertools.description.csv"

    #-- add menu entries
    ForEach ($file in (dir "$($cfg.usertools)\*.*")) {
        $fn = $file.Name

        #-- MenuItem + Image
        $meta = $desc | ? { $_.file -eq $fn }
        if (!$meta) { $meta = @{icon="icon.copy.png"; desc=""} }
        $ICON = W Image @{Source=(Get-IconPath $meta.icon); Height=18; Width=18}
        $m.Add((W MenuItem @{Header="_$fn"; Tooltip=$meta.desc; Icon=$ICON; Add_click={ copy-UserTool "$fn" }.getnewclosure()}))
42
43
44
45
46
47
48
49
50
51
52
            if ((!$username) -or (!(Test-Path "\\$machine\c$\Users\$username\Desktop\"))) {
                $username = "Public"
            }
            $dest = "\\$machine\c$\Users\$username\Desktop\"

            #-- copy
            Out-Gui "❏ '$fn' to $dest"
            Copy "U:\Tools\UserTools\$fn" "$dest"
        }
    }
}







|



45
46
47
48
49
50
51
52
53
54
55
            if ((!$username) -or (!(Test-Path "\\$machine\c$\Users\$username\Desktop\"))) {
                $username = "Public"
            }
            $dest = "\\$machine\c$\Users\$username\Desktop\"

            #-- copy
            Out-Gui "❏ '$fn' to $dest"
            Copy "$($cfg.usertools)\$fn" "$dest"
        }
    }
}