sublimetext2 - start opened file from sublimetext in associated program -
i edit files in sublime text 2 can edited , compiled program. have them opened in sublimetext following:
- right click , choose "copy file path" (to clipboard)
- win+r open windows run dialog
- ctrl+v paste file path
- hit enter open file associated program
i wonder shortcut can configured automatically starts opened file associate program
thanks in advance
this can done. in similar situation using sublime editor of choice on default sas program editor. able use win32com.client.dynamic.dispatch
module connect sas via ole , pass text sublime directly sas using sublime's build system call plugin. making connection easy part, other processing had time consuming part, since want pass file name or entire contents of file, should straightforward plugin. since not know program wish open, here code makes implementation work. maybe caan glean out of this.
def send_to_sas_via_ole(selected_code): win32com.client.dynamic import dispatch sasinstance = dispatch("sas.application") # submit lines sas selection in selected_code: # reason cannot send 1 big line sas, split # multipe lines , send line line line in selection.splitlines(): sasinstance.submit(line)
and call in run method of plugin class:
class runsasmakocommand(sublime_plugin.textcommand): def run(self, edit): try: send_to_sas_via_ole(selected_code) except exception e: print "\n".join(selected_code) print "couldn't connect sas ole" print e
good luck!