newコマンドを作ってみた
アクティブな、または指定した ウィンドウを新規にもういっこ開くSvitchコマンド。
exe_folder.pyを少し書き換えただけ。
ProcessStartInfo()の使い方がさっぱりわからないので、余計なことをしているかもしれません。
[追記]
変な名前がいくつかあるかも。書き直してみました。
「Python」も「.Netなんとか」も覚えて初日の素人仕事なので、直してもらえると喜びます。
# -*- coding: Shift-JIS -*- import clr import CommandPlugin from CommandPlugin import * clr.AddReferenceByPartialName("System") from System import IntPtr from System.Windows.Forms import MessageBox from System.Diagnostics import ProcessStartInfo, Process from System.IO import Path class new_exe(CommandPlugin.PythonCommand): def run(self, arg_list): # argumentで指定したデフォルトの引数は無視する arg_list.RemoveAt(0) if len(arg_list) == 0: # 入力した引数がない場合は最前面のウィンドウの実行ファイルを開く if info.last_fore_window != IntPtr(0): if not WinAPI.IsIconic(info.last_fore_window): win = info.GetTaskWindow(info.last_fore_window) self.run_exe(win.exePath) else: # 入力した引数がある場合はヒントの文字と一致したウィンドウの実行ファイルを開く for arg in arg_list: index = info.hint_list.IndexOf(arg.ToUpper()) if index != -1: self.run_exe(info.window_list[index].exePath) def run_exe(self, path): psi = ProcessStartInfo() psi.FileName = path psi.RedirectStandardInput = False psi.RedirectStandardOutput = False psi.UseShellExecute = True psi.CreateNoWindow = True Process.Start(psi)