Posts

Showing posts with the label automating

A Good Mix 25: The SharePoint Object Model, IronPython Tutorial, Crazy Snake and IronRuby

Yet another collection of IronPython and DLR related articles, projects and blog entries from the past few weeks. Using the SharePoint Object Model with IronPython  The iLove SharePoint blog recently posted an example of using the SharePoint object model from IronRuby . In the interests of balance he has posted the same example with IronPython. IronPython Tutorial: Basics IronPython Tutorial: Advanced (Events, Delegates, WinForms, WPF) IronPython Tutorial: Debugging (CLR Debugger)  The AvbWiki, a Russian developer wiki, has put online several IronPython tutorial pages. It looks like it is mainly based on the tutorial that comes with IronPython 2, but could be a useful online reference on IronPython. Intellisense for IronPython  Another release from the mysterious Japanese IronPython and Windows Forms project that we've covered before . crazysnake; ironpython and java, just monkeying around  This weekend I finally got around to downloading IronPython 2.6rc1 ...

New Release of VisioAutomation library

Microsoft Visio is a popular vector diagramming programming for Windows. As with other Microsoft programs it can be automated and extended with COM, which can easily be done from .NET languages like C# and IronPython. VisioAutomation is " a .NET Library that simplifies automating Visio from .NET languages such as C#, F#, IronPython and a set of tools that use that library. " It is useful for: Writing managed-code Add-Ins for Visio 2007 Writing tools to automate Visio 2007 from command line Use it as a reference to learn how to do common Visio automation tasks Version 2 of VisioAutomation has just been released. As well as various tools and libraries the latest version includes an experimental interactive environment built on IronPython and libraries to support using VisioAutomation from IronPython. Releasing a new version of my VisioAutomation library (version 2.0.0) Today I’m releasing the latest version of the VisioAutomation library on CodePlex: http://visioauto...

A Good Mix 16: Metaprogramming, Talks, PyDev, Excel and Testing

Another selection of articles, audio recordings and blog entries on IronPython collected from around the web. How I Learned to Love Metaprogramming Slides and code from a talk by Kevin Hazzard on metaprogramming on the .NET framework using C# 4.0 and IronPython. The title of my presentation was "How I Learned to Love Metaprogramming" and it concerns Dynamic Language Runtime architecture, performance of dynamic typing and Python to C# integration. The slides and source code are linked below. I will be giving this talk again in September at the Charlottesville .NET User Group meeting. Both of the demos require C# 4.0 which is available in Visual Studio 2010. Demo One - shows how to do XML parsing using a fluent interface based on a DynamicObject derivation in C# 4.0 Demo Two - shows how the Level 0, 1 and 2 CallSite and ActionBinder caches perform. UPDATED: I added a demo on 30 June 2009 that shows how the DLR 0.9 compares by invoking dynamic code through the DLR hosting APIs,...

A Good Mix 4: NWSGI, AutoCAD, Another ctypes and C# in Depth

Another fine selection of IronPython related links for your delectation. NWSGI 1.1 Preview 1 NWSGI is " a .NET implementation of the Python WSGI specification for IronPython. It is implemented as an ASP.NET HttpHandler for use with IIS 6 and 7 " created by Jeff Hardy . The goal is to be able to run Python applications like Django, Trac and Pylons on IronPython. It can also be used on the Microsoft Azure (cloud computing) platform. This new release is a pre-release which depends on IronPython 2.6 Alpha 1 . The following features/changes have been added to NWSGI: Add " callable " attribute to scriptMapping to specify the callable for that script. Allow for "virtual" scripts by extending callables to allow for package.module:callable. This can avoid creating a .wsgi file in many scenarios. This can be used with wildcard mappings by specifying wildcardModule=":callable". Use the "debug" attribute on system.web/compilation instead of on ws...

Through the Interface: AutoCAD and IronPython

Kean Walmsley, of the "Through the Interface" blog, is an AutoCAD programmer who has been meaning to try out Python for some time. He is somewhat sceptical of dynamic typing, but has heard many good things about Python: Python is also of interest because of its cross-platform availability: it’s an open source language with its roots in the UNIX/Linux world, but is now gaining popularity across a variety of OS platforms (one of the reasons it’s the scripting language chosen for at least one of our cross-platform products, Autodesk Maya). He has a (short) series of blog entries on getting IronPython (and IronRuby) working with AutoCAD. Using IronPython with AutoCAD I had originally hoped to build a .NET assembly directly using IronPython – something that appears to have been enabled with the 2.0 release of IronPython - which could then be loaded into AutoCAD. Unfortunately this was an exercise in frustration: AutoCAD makes heavy use of custom attributes for identifying commands...

Visio from IronPython and Powershell, Parts II & III

Saveen Reddy posted recently on automating Visio to draw diagrams from the command line . He has followed this up with two more posts. Both posts use the Visio automation API from IronPython and Powershell, and have plenty of screenshots to show you the results of the interactive code examples he presents. Visio/IronPython/Powershell - Part 2 - Drawing Diagrams from Data This post discusses using data to generate your diagrams; specifically tabular, hierarchical data, and directed graphs: Draw some simple shapes >>> vi.Draw.Rectangle( 0, 0, 1,1 ) >>> vi.Draw.Oval( 2, 2, 3,3 ) >>> vi.Draw.Line( 4, 4, 5,5 ) Loading data from a CSV file exported from Excel. The interactive shell extensively uses System.Data.DataTable to store tabular data >>> data = ( ('Hello',1) , ('World',2) ) >>> datatable = ToDataTable( data ) >>> vi.Draw.Table( datatable ) create a CSV file in Excel And then load it as a DataTable and let Visio Dra...

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: Visio/IronPython/Powershell – How to draw nice diagrams from the command line 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 importa...

GUI Automation: Building the Framework (3)

After a hiatus, the GUI Automation blog continues the series on the automated testing of Windows GUI applications. This entry uses the Win32 API to interact with a list box. As usual source code is provided for download: Building the Framework (3) In the entry Lukas makes an important point about any testing framework: We do not test the list box component. We test the application. When testing an application you don't need to test the functionality provided by the operating system or the frameworks you're using; you test your application logic. Example code for selecting an item in a list box from the application under test (is SUT for "System Under Test" a commonly used acronym?): def Select(self, aItem): """ select an item from list box @aItem - string with item to select """ if aItem not in self.items: raise Exception("Item '%s' not in list box" % aItem) self.guiat.Activate() self._CheckVisibility()...

Visio Automation: Three Hello World Samples – C#, F#, and IronPython

Saveen Reddy has posted examples of automating Visio from three different languages - C#, F#, IronPython. The code samples are short, and remarkably similar. The examples all do the same thing: launch Visio 2007, create a new doc, and draw a rectangle with the text “Hello World” . Visio Automation: Three Hello World Samples – C#, F#, and IronPython The IronPython is: import sys import clr import System clr.AddReference("Microsoft.Office.Interop.Visio") import Microsoft.Office.Interop.Visio IVisio = Microsoft.Office.Interop.Visio visapp = IVisio.ApplicationClass() doc = visapp.Documents.Add("") page = visapp.ActivePage shape = page.DrawRectangle(1, 1, 5, 4) shape.Text = "Hello World"