First open a commandPort in Maya
commandPort -n ":2222";
Here is a sublime text plugin that sends the selection to that port.
import sublime, sublime_plugin, socket, re
def run(self, edit):
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
regions = self.view.sel()
for r in regions:
txt = self.view.substr(r)
txt = re.sub('//.*?(\r\n?|\n)|/\*.*?\*/', '', txt, re.S)
txt = txt.replace('\n', ' ').replace('\r',' ')
Each region is treated as submission. I guess there will usually be only one.
The regex gets rid of comments in a fairy naive way.
Then the next line puts the whole script on one line so you can submit multiline scripts.
To run, select the code you want to send, and enter the following in the console: