sublime

sublime下运行外部exe程序

2018-05-30  本文已影响9人  勇于改变

第一步:创建插件文件 runProject.py

import sublime

import sublime_plugin

import os

class RunProject(sublime_plugin.TextCommand):

def run(self, edit):

os.system("start /D  D:\\project\\test test.exe")

第二步:打开Key Bindings添加如下json

{"keys":["f2"],"command":"run_project"},

第三步:按f2执行程序 test.exe

补充:

关于传参

{"keys":["f2"],"command":"run_project","args":{"ver":"project"}},

{"keys":["f3"],"command":"run_project","args":{"ver":"0.1.60.0"}},

代码可改为:

import sublime

import sublime_plugin

import os

class RunProject(sublime_plugin.TextCommand):

def run(self, edit,ver):

os.system("start /D  D:\\project\\"+ver+" test.exe")

上一篇下一篇

猜你喜欢

热点阅读