Hello,
I'm new at Ironpython, I've been looking at a way to interact dynamically with PowerPoint.

I got some simple code to work to access the text in a box which is selected in PowerPoint:

import clr
from System.Runtime.InteropServices import Marshal
clr.AddReference("Microsoft.Office.Interop.PowerPoint")
import Microsoft.Office.Interop.PowerPoint as PowerPoint
ppt = Marshal.GetActiveObject("PowerPoint.Application")
sel = ppt.ActiveWindow.Selection.TextRange
print sel.Text

This is nice, because if I change the text that was initially selected in PowerPoint, and do "print sel.Text" again, I get the updated text in Python (i.e., I get a reference to the TextRange object, which I can interogate with the Text method when changes are made in PowerPoint).

My question is: is there a way to register an event handler to do some action automatically when the text is modified in PowerPoint? Ideally, I'd like my Python script to execute some actions whenever the TextRange object is modified in PowerPoint. If that's not feasible, I could also run those actions when the user does something particular (like changing his selection, or saving his PPT file).

I've been trying to introspect my Python objects, but couldn't locate anything that would allow me to setup my event handler.

Any comment or suggestion would be greatly appreciated.

Thanks,
Julien.
_______________________________________________
Users mailing list
[email protected]
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com

Reply via email to