I wrote some code for two Microsoft Outlook related leo commands. The
first command will insert the unique ID of the currently selected
Microsoft Outlook email (assumes you have Outlook open and running)
into the leo body text.
The inserted text will look like:
outlook:(long string of alphanumeric chars here) <MESSAGE: email
subject here>
The second command will open the email corresponding to the outlook
"hyperlink". I didn't take the trouble of looking into how to make it
a true clickable hyperlink in leo. Instead the command assumes you
have selected the link text.
Only select the outlook email id portion and not the <MESSAGE: ...>
portion, i.e.
outlook:00000000B19B11D5BD6.....
Here is the code:
# win32com.client from http://sourceforge.net/projects/pywin32/files/pywin32
import win32com.client
@g.command("insert-outlook-email-link")
def insertOutlookEmailLink(event):
c=event['c']
ol = win32com.client.Dispatch("Outlook.Application")
m = ol.ActiveExplorer().Selection.Item(1)
u = "outlook:%s <MESSAGE: %s>" % (m.EntryID, m.Subject)
w = c.frame.body.bodyCtrl
i = w.getInsertPoint()
w.insert(i,u)
import subprocess
@g.command("open-selected-outlook-link")
def openSelectedOutlookLink (event):
c = event['c']
r = c.frame.body.getSelectionRange()
url = c.frame.body.get(r[0], r[1])
# The DOS 'start' command understands "outlook:..." urls
subprocess.Popen("cmd /k start " + url)
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.