|
Half-baked opinions, served lukewarm.
|
archive | search |
| barnson webmail | music | recent posts | resumé | |
NavigationUser loginBrowse archivesPopular contentWho's onlineThere are currently 0 users and 23 guests online.
|
Twitter Updates |
The MS Way
Try this:
- Copy the following into a file and name it 'launchvim.vbs'
- In Outlook, Go To Tools->Macros->VB Editor (Make sure your Security settings for Outlook are set to Medium)
- Add a new module, and paste this into it
- Open a new Outlook mail message
- Click View->Toolbars->Customize
- Under the Commands tab, Select Macros on the left, and drag the macro you just created to the Outlook toolbar in your newly opened mail dialog.
Voila! Now you can launch vim from the Outlook toolbar!Option Explicit Private Sub launch() Const TemporaryFolder = 2 Dim ws, ol, insp, item, body, fso, tempfile, tfolder, tname, tfile Set ol = CreateObject("Outlook.Application") Set insp = ol.ActiveInspector If insp Is Nothing then Exit Sub End if Set item = insp.CurrentItem If item Is Nothing then Exit Sub End if body = CStr(item.Body) Set fso = CreateObject("Scripting.FileSystemObject") Set tfolder = fso.GetSpecialFolder(TemporaryFolder) tname = fso.GetTempName Set tfile = tfolder.CreateTextFile(tname) tfile.Write( Replace( body, Chr(13) & Chr(10), Chr(10) ) ) tfile.Close() Set ws = WScript.CreateObject("WScript.Shell") Wsh.Echo( "c:\vim\vim62\gvim.exe " & tfolder.Path & "\" & tname ) ws.Run "c:\vim\vim62\gvim.exe " & tfolder.Path & "\" & tname ,4, true Set tfile = fso.OpenTextFile(tfolder.Path & "\" & tname, 1 ) item.body = Replace( tfile.ReadAll, Chr(10), Chr(13) & Chr(10) ) tfile.close() fso.DeleteFile( tfolder.Path & "\" & tname ) End Sub Call launch()Sub LaunchVIM() Dim windir As String windir = Environ("WinDir") Shell (windir & "\system32\cscript.exe " & windir & "\system32\launchvim.vbs") End SubEDIT by matthew: cleaned up formatting for slightly easier readability.