Created
January 25, 2010 06:51
-
-
Save valda/285686 to your computer and use it in GitHub Desktop.
ntemacs/emacsclientw のラッパスクリプト
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
' | |
' C:\emacs23.1\bin\emacsclientw.vbs | |
' | |
Set objShell = WScript.CreateObject("WScript.Shell") | |
Set fso = CreateObject("Scripting.FileSystemObject") | |
strComputer = "." | |
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") | |
Set colItems = objWMIService.ExecQuery("Select * From Win32_Process") | |
Dim emacsProcess | |
emacsProcess = null | |
For Each objItem in colItems | |
If InStr(objItem.CommandLine, "emacs.exe") Then | |
Set emacsProcess = objItem | |
End If | |
Next | |
If IsNull(emacsProcess) Then | |
If WScript.Arguments.Count = 0 Then | |
objShell.Run(fso.GetParentFolderName(WScript.ScriptFullName) & "/runemacs.exe") | |
Else | |
objShell.Run("""" & fso.GetParentFolderName(WScript.ScriptFullName) & "/runemacs.exe"" """ & WScript.Arguments(0) & """") | |
End If | |
Else | |
If WScript.Arguments.Count = 0 Then | |
objShell.AppActivate emacsProcess.ProcessID | |
Else | |
objShell.Run("""" & fso.GetParentFolderName(WScript.ScriptFullName) & "/emacsclientw.exe"" -n """ & WScript.Arguments(0) & """") | |
End If | |
End If |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment