PyWin32


Most typical users have used Microsoft Office. While Office may be the bane of tech support, we still have to deal with it. Python can be used to script (AKA automate) Office and make it easier for us or our users to use. It may not be as easy as recording a macro, but it’s close. For this article, you will learn how to use the PyWin32 module to access some of the Office programs and manipulate them with Python. Some forums say that you need to run PythonWin’s makepy utility on Microsoft Word (and Excel) before you can access Office applications. I don’t think I needed to do that to make it work though (at least, not with the 2007 version). However, PythonWin comes with the PyWin32, so if you do run into trouble, you can try it. (more…)

Back when I first wrote about creating shortcuts with Python last month, I kept thinking to myself that I had a 3rd way of doing it. Today, I had to maintain some of my shortcut code and I stumbled upon it once more. I also noticed that my post had received a comment from Tim Golden on yet another way to create shortcuts, so I’ll include that in this post as well. (more…)

The past couple of days, I’ve needed a way to create a shortcut on a user’s desktop during the login process. I had a way that worked for most shortcuts, but I just could not figure out how to do this one.

(more…)

One of the first scripts I had to help translate from Kixtart to Python was our map drives script. In it, we would map drives based on either which group the user was in and/or what a custom registry entry said. Here is a partial example of each of these categories in Kixtart:

IF READVALUE("HKEY_LOCAL_MACHINE\SOFTWARE\MyOrg", "Office")= "officeName"
$Drive="g:" $Path="\\serverName\" + @userid Call "@lserver\\folderName"
ENDIF
 
IF InGroup("Dept XYZ")
$Drive="g:" $Path="\\serverName\" + @userid Call "@lserver\\folderName"
ELSE
ENDIF

(more…)

We’ve been discussing how to use OpenVPN with Python in the last two articles. In this final post, I’ll show how to bring it all together into a GUI with some wxPython code. I’m also going to discuss some important snippets.

(more…)

This is the 2nd part of a 3-part series on using wxPython + PyWin32 to grab the output from an OpenVPN session on Windows. In this article, I will show how how to start OpenVPN with Python and how to watch a file that OpenVPN writes its data logs to.

(more…)

I’m doing a 3 part series on using wxPython and PyWin32 to capture output from a running OpenVPN session.

I use OpenVPN to connect to PCs at work. I noticed that our current method of launching OpenVPN was in a console window so that one could monitor the program’s output. If the user happened to close said window, it would end the VPN session. I thought this was dumb, so I decided that I would try wrapping the interface using wxPython in such a way that I can minimize it to the system tray and bring it back up on demand to check the output if I was having an issue. (more…)