0

我通常用 sublime text 2 编辑文件,这些文件也可以用另一个程序编辑和编译。因为我已经在 sublimetext 中打开了它们,所以我执行以下操作:

  1. 右键单击并选择“复制文件路径”(到剪贴板)
  2. Win+R 打开windows运行对话框
  3. CTRL+V 粘贴文件路径
  4. 按回车键打开带有关联程序的文件

我想知道可以配置一些快捷方式,以便它使用其关联程序自动启动打开的文件

提前致谢

4

3 回答 3

0

右键单击该文件,按“属性”。您将看到Opens with SomeProgram一个更改按钮。单击更改按钮,然后查看 Sublime Text 的列表,如果找不到,您可以使用文件资源管理器选择一个应用程序,从那里您可以导航到C:\Program Files\Sublime Text 2并选择 sublime_text.exe

于 2013-12-15T03:41:45.677 回答
0
  1. 打开“regedit.exe”;
  2. 导航

    HKEY_CLASSES_ROOT\Applications\sublime_text.exe\shell\open\command
    
  3. 更正路径。退出“regedit.exe”

  4. (可选)重新启动“explorer.exe”或重新启动您的 PC。

享受:p;

于 2013-12-12T07:28:07.927 回答
0

This can be done. I was in a very similar situation using Sublime as my editor of choice over the default SAS program editor. I was able to use the win32com.client.dynamic.Dispatch module to connect to SAS via OLE and pass text from Sublime directly to SAS using Sublime's build system to call my plugin. Making the connection was the easy part, it was the other processing that I had to do which was the time consuming part, but since you want to pass just a file name or the entire contents of your file, this should be a fairly straightforward plugin. Since I do not know what program you wish to open, here is the code that makes my implementation work. Maybe you caan glean something out of this.

def send_to_sas_via_ole(selected_code):

    from win32com.client.dynamic import Dispatch
    sasinstance = Dispatch("SAS.Application")

    # submit the lines to sas
    for selection in selected_code:
        # for some reason cannot send as one big line to SAS, so split into
        # multipe lines and send line by line
        for line in selection.splitlines():
            sasinstance.Submit(line)

and then the call in the run method of my plugin class:

class RunSasMakoCommand(sublime_plugin.TextCommand):

def run(self, edit):

    try:
        send_to_sas_via_ole(selected_code)
    except Exception as e: 
        print "\n".join(selected_code)
        print "Couldn't connect to SAS OLE"
        print e

Good luck!

于 2013-04-25T13:52:23.763 回答