Visio/IronPython/Powershell – How to draw nice diagrams from the command line

Saveen Reddy has an automation project for working with Visio - a technical drawing package from Microsoft. The automation project allows you write extensions, plus use Visio from the command line: Visio Automatic Extensions.

He's posted before on this project, for example his hello world in C#, F# and IronPython article. This entry provides lots more examples (with huge screenshots), this time on using the Powershell and IronPython interactive interpreters to drive Visio:
Demo 1 – Shape formatting

Python
>>> vi.Start()

Powershell
vis> $vi.Start()

This will launch a new instance of Visio 2007 that is bound to the Interactive session. When Visio launches this way a new doc will be created with a single empty page. It will also load the Basic Shapes stencil – the interactive session depends on this stencil being loaded.

Draw some shapes in visio. Then select them all.

The selection is important – most of the VisioInteractive commands work on the active selection.

in the interactive shell, set the fill foreground color to red

Python: vi.Fill.ForegroundColor = 0xff0000

Powershell: $vi.Fill.ForegroundColor = 0xff0000

Comments

Popular posts from this blog

Extending Abobe Flash Player and AIR with Python and Ruby

IronPython Tools for Visual Studio CTP3

Further Adventures of the Debugger