VisioStencilSearchPath.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<#
        .SYNOPSIS
        Adds a path to the Stencil search path list
        .DESCRIPTION
        Adds a path to the Stencil search path list. When registering a stencil, if you only supply a filename, the function will search
        in the folders listed in the Stencil search path for a matching file and use the first one found.
        .PARAMETER Path
        The path to add to the search path.
        .INPUTS
        None. You cannot pipe objects to Add-StencilSearchPath.
        .OUTPUTS
        None
        .EXAMPLE
        Add-StencilSearchPath 'C:\temp'
 #>
 
 function Add-StencilSearchPath{
    [CmdletBinding()]
    Param([string]$Path)
    $script:StencilSearchPath.Add($Path) | Out-Null
}

<#
        .SYNOPSIS
        Resets the stencil search path list
        .DESCRIPTION
        Resets the stencil search path list. When registering a stencil, if you only supply a filename, the function will search
        in the folders listed in the Stencil search path for a matching file and use the first one found.
        .PARAMETER Path
        The list of paths to set the search path to.
        .INPUTS
        None. You cannot pipe objects to Set-StencilSearchPath.
        .OUTPUTS
        None
        .EXAMPLE
        Set-StencilSearchPath 'C:\temp','C:\Program Files (x86)\Microsoft Office\Office15\Visio Content'
 #>
 
 function Set-StencilSearchPath{
    [CmdletBinding(SupportsShouldProcess=$true)]
    Param([string[]]$Path)
    if($PSCmdlet.ShouldProcess("Setting Stencil Search Path to $path")){
        $script:StencilSearchPath=$Path
    }
}

<#
        .SYNOPSIS
        Retrieves the stencil search path
        .DESCRIPTION
        Retrieves the stencil search path. When registering a stencil, if you only supply a filename, the function will search
        in the folders listed in the Stencil search path for a matching file and use the first one found.
        .INPUTS
        None. You cannot pipe objects to Get-StencilSearchPath.
        .OUTPUTS
        String[]
        .EXAMPLE
        Get-StencilSearchPath
 #>
 
 function Get-StencilSearchPath{
    [CmdletBinding()]
    Param( )
    $script:StencilSearchPath 
}