Skip to content

Instantly share code, notes, and snippets.

@qtxie
Created November 9, 2014 08:52
Show Gist options
  • Save qtxie/38f5871d53bbc22314ce to your computer and use it in GitHub Desktop.
Save qtxie/38f5871d53bbc22314ce to your computer and use it in GitHub Desktop.
Script for running red in EverEdit
Dim strCommand
Dim strFilename
Dim strOutput
Dim strLog
strFilename = App.ActiveDoc.PathName
strLog = strFilename & ".result"
strCommand = "cmd /c E:\red-043.exe {0} > {1} 2>&1"
strCommand = Replace(strCommand, "{0}", strFilename)
strCommand = Replace(strCommand, "{1}", strLog)
Set objShell = CreateObject("WScript.Shell")
' Not show window and wait until finished
objShell.Run strCommand, 0, True
Set fso = CreateObject("Scripting.FileSystemObject")
Set file = fso.OpenTextFile(strLog, 1, False, -1)
If file.AtEndOfStream Then
' No output
Else
strText = file.ReadAll
file.close
App.OutputText strText, True, False
End If
Set fso = Nothing
Set objShell = Nothing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment