Simple Visio Automation from Powershell
PowerShell
Latest commit d14f7df Aug 25, 2016 @MikeShepard committed on GitHub Merge pull request #65 from MikeShepard/Develop
Switched Settings to use ArgumentToConfigurationDataTransformation at…
Permalink
Failed to load latest commit information.
Examples Switched Settings to use ArgumentToConfigurationDataTransformation at… Aug 25, 2016
.gitignore added file to gitignore Apr 11, 2016
License.md Added license file Mar 26, 2016
PowerShell And Visio.pptx Updated PowerPoint Apr 7, 2016
README.md Updated readme.md. Fixed #27. May 10, 2016
VisioApplication.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioBasicShapes.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioBot3000.psd1 Added module manifest Mar 25, 2016
VisioBot3000.psm1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioBot3000Aliases.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioBot3000Variables.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioColorFormula.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioConnector.ps1 Added |out-null to many function calls to remove extraneous output. F… May 11, 2016
VisioConstants.ps1 Updated VisioConstants with Diagram Services constants. Jun 8, 2016
VisioContainer.ps1 Added |out-null to many function calls to remove extraneous output. F… May 11, 2016
VisioDiagramServices.ps1 Added VisioDiagramServices file with get/set functions. Jun 8, 2016
VisioDocument.ps1 Added |out-null to many function calls to remove extraneous output. F… May 11, 2016
VisioExport.ps1 Added comment-based help to Convert-VisioObjectToPSObject. Fixed #56 May 13, 2016
VisioHyperlink.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioLayer.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioPage.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioPositioning.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioSelection.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioSettings.ps1 Switched Settings to use ArgumentToConfigurationDataTransformation at… Aug 25, 2016
VisioShape.ps1 Added |out-null to many function calls to remove extraneous output. F… May 11, 2016
VisioShapeData.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioStencil.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016
VisioStencilSearchPath.ps1 Added |out-null to many function calls to remove extraneous output. F… May 11, 2016
VisioText.ps1 Split functions out to multiple ps1 files mainly based on noun May 11, 2016

README.md

VisioBot3000

Join the chat at https://gitter.im/MikeShepard/VisioBot3000

Simple Visio Automation from Powershell

A module with some useful function definitions to do diagrams in Visio.

Also exposes a DSL which lets you create diagrams without "scripting".

Primitive Operations

  • New-VisioApplication
  • Get-VisioApplication
  • New-VisioDocument
  • Open-VisioDocument
  • New-VisioPage
  • Set-VisioPage
  • Get-VisioPage
  • Remove-VisioPage
  • New-VisioRectangle
  • Set-VisioPageLayout
  • New-VisioShape
  • New-VisioConnector
  • New-VisioContainer
  • Register-VisioBuiltInStencil
  • Register-VisioStencil
  • Register-VisioShape
  • Register-VisioContainer
  • Register-VisioConnector
  • Get-VisioShape
  • New-VisioHyperLink
  • New-VisioSelection
  • Set-VisioShapeData
  • Get-VisioShapeData
  • Complete-Diagram
  • New-VisioLayer
  • Set-NextShapePosition
  • Get-NextShapePosition
  • Set-RelativePositionDirection
  • Set-VisioText
  • Get-VisioColorFormula
  • Add-StencilSearchPath
  • Set-StencilSearchPath
  • Get-StencilSearchPath

Aliases

  • Diagram (New-VisioDocument)
  • Stencil (Register-VisioStencil)
  • Shape (Register-VisioShape)
  • Container (Register-VisioContainer)
  • Connector (Register-VisioConnector)

Lots of examples in the "Examples" folder

Example using "Primitives"

Import-Module VisioBot3000 -Force

New-VisioApplication

New-VisioDocument C:\temp\TestVisio3.vsdx 
Register-VisioStencil -Name Containers -Path C:\temp\MyContainers.vssx 
Register-VisioStencil -Name Servers -Path C:\temp\SERVER_U.vssx
Register-VisioShape -Name WebServer -From Servers -MasterName 'Web Server'
Register-VisioContainer -Name Location -From Containers -MasterName 'Location'
Register-VisioContainer -Name Domain -From Containers -MasterName 'Domain'
Register-VisioContainer -Name Logical -From Containers -MasterName 'Logical'

New-VisioContainer -shape (Get-VisioShape Logical) -label MyFarm -contents {
    New-VisioContainer -shape (Get-VisioShape Location) -label MyCity -contents {
        New-VisioContainer -shape (Get-VisioShape Domain) -label MyDomain -contents {
            New-VisioShape -master WebServer -label PrimaryServer -x 5 -y 5
        }
    }
    New-VisioContainer -shape (Get-VisioShape Location) -label DRSite -contents {
        New-VisioContainer -shape (Get-VisioShape Domain) -label MyDomain -contents {
            New-VisioShape -master WebServer -label BackupServer -x 5 -y 8
        }
    }
    New-VisioConnector -From PrimaryServer -To BackupServer -Label SQL -Color Red -Arrow
}

Same Example using DSL

Diagram C:\temp\TestVisio3.vsdx 
Stencil Containers -From C:\temp\MyContainers.vssx 
Stencil Servers -From C:\temp\SERVER_U.vssx
Shape WebServer -From Servers -MasterName 'Web Server'
Container Location -From Containers -MasterName 'Location'
Container Domain -From Containers -MasterName 'Domain'
Container Logical -From Containers -MasterName 'Logical'
Connector SQL -Color Red -arrow


Logical MyFarm {
    Location MyCity {
        Domain MyDomain {
            WebServer PrimaryServer 5 5
        }
    }
    Location DRSite {
        Domain MyDomain {
            WebServer BackupServer 5 8
        }
    }
    SQL -From PrimaryServer -To BackupServer
}