News for hackers. Stuff that matters.
Re:Automating Microsoft Office with Python by unlimitedbacon on Sunday September 01, 2013 @03:39PM (#6311783)
Years ago, at my first internship, we were assigned to copy fields of information out of hundreds of PDF files and compile them into a single spreadsheet. While my coworker began dutifully trudging away, I started googling and found out about the COM API and the Python library. I spent the rest of my time writing a script to automate the task.

The silly and wonderful thing about the Office API is that it doesn't work silently, but instead performs the operations on screen as if they were being done by a human being. The article explains this. There's something very satisfying about seeing the reaction of your boss as he watches the computer do the work on its own, as if its being operated by a ghost. Now I know what it must have been like to see a player piano a hundred years ago.

Re:Automating Microsoft Office with Python by agumonkey on Sunday September 01, 2013 @05:27PM (#6312234)
In VBA there's a command to toggle screen redrawing, isn't it exposed through COM ? very impactful on performance, although I too like to witness high speed visual feedback of automated processing. The social implications are surprising too.
Re:Automating Microsoft Office with Python by pge on Monday September 02, 2013 @03:08PM (#6316596)
One of the first things i learned about writing VBA macros was to start every one with application.screenupdating = false. It was amazing how much of a performance hit the screen updating was.
Re:Automating Microsoft Office with Python by agumonkey on Monday September 02, 2013 @04:48PM (#6317122)
I remember at least three "mandatory" statement to wrap any heavy script. Actually I don't remember them, just some fuzzy count.

ps: I don't know how Excel is structured these days but up until 2003 there was zero multicore code, and VBA is not the fastest system around, so any way you can trim the workload is good.

Re:Automating Microsoft Office with Python by ams6110 on Sunday September 01, 2013 @04:07PM (#6311917)
Kind of like the CSI computers that show every fingerprint and mugshot on the screen as the system searches for a match.
Re:Automating Microsoft Office with Python by benjarrell on Sunday September 01, 2013 @06:55PM (#6312534)
I always think of the IO requirements doing that would impose.
Re:Automating Microsoft Office with Python by mataug on Sunday September 01, 2013 @11:55PM (#6313391)
There was a related joke the author made about Office API redrawing each and every change. Just to speed things up He would keep moving the window around, and suddenly things would speed up.
Re:Automating Microsoft Office with Python by kanzure on Sunday September 01, 2013 @08:03PM (#6312751)
Can you still use Office dlls without the Office GUI clicking away in front of you? Is this a limitation of using COM with Office?
Re:Automating Microsoft Office with Python by sanand0 on Sunday September 01, 2013 @11:28PM (#6313332)
You can for Word and Excel. Just set Application.Visible = False.

However, I haven't found a way of turning this off for PowerPoint. On the other hand, one of the weird quirks is that the API draws much faster if you keep the window dragged. I've spent a fair bit of time keeping the PowerPoint window dragged while Python drives COM!