<div>There's a reference for the TextRange object at <a href="http://msdn.microsoft.com/en-us/library/bb251500.aspx">http://msdn.microsoft.com/en-us/library/bb251500.aspx</a>. It doesn't look like it supports any events. From what I can tell, all the events for PowerPoint are defined on the Application object: <a href="http://msdn.microsoft.com/en-us/library/bb251405.aspx">http://msdn.microsoft.com/en-us/library/bb251405.aspx</a>. Perhaps the WindowSelectionChange event will do what you want.</div>
<div><br> </div>
<div class="gmail_quote">On Tue, Jun 24, 2008 at 4:51 PM, Julien Sylvestre <<a href="mailto:jusylves@videotron.ca">jusylves@videotron.ca</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hello,<br> I'm new at Ironpython, I've been looking at a way to interact dynamically with PowerPoint.<br>
<br>I got some simple code to work to access the text in a box which is selected in PowerPoint:<br><br>import clr<br>from System.Runtime.InteropServices import Marshal<br>clr.AddReference("Microsoft.Office.Interop.PowerPoint")<br>
import Microsoft.Office.Interop.PowerPoint as PowerPoint<br>ppt = Marshal.GetActiveObject("PowerPoint.Application")<br>sel = ppt.ActiveWindow.Selection.TextRange<br>print sel.Text<br><br>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).<br>
<br>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).<br>
<br>I've been trying to introspect my Python objects, but couldn't locate anything that would allow me to setup my event handler.<br><br>Any comment or suggestion would be greatly appreciated.<br><br>Thanks,<br>Julien.<br>
_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.ironpython.com" target="_blank">Users@lists.ironpython.com</a><br><a href="http://lists.ironpython.com/listinfo.cgi/users-ironpython.com" target="_blank">http://lists.ironpython.com/listinfo.cgi/users-ironpython.com</a><br>
</blockquote></div><br>