Awesome Nick! I've been bringing myself quickly up-to-speed with your useful youtube videos and documentation. I'm thoroughly impressed with MUSH client and the sheer amount of effort that must've went in to this program, website, and documentation.
Anyways, I have everything working almost like I want it, just one piece eludes me:
I can use the Lua function:
os.execute
For example, I used / as my script prefix on the MUSH client command window:
/os.execute('E:\"XNA Stuff"\Client\bin\Release\Client.exe "cmd line param"')
I don't work much with Lua, but I found it was necessary to escape all the backslashes in the OS command.
My program executes in the background and does not spawn a command window.
However when I execute the above a "C:\Windows\system32\cmd.exe" appears while my program is executing.
I can instead use:
/os.execute('start /min E:\"XNA Stuff"\Client\bin\Release\Client.exe "cmd line param"')
or
/os.execute('start /B E:\"XNA Stuff"\Client\bin\Release\Client.exe "cmd line param"')
Which causes this command windows to "flash" briefly. I'd like for no flashing window at all... any suggestions?
I did some research on my own and found it's most likely a Lua limitation:
http://stackoverflow.com/questions/6362841/use-lua-os-execute-in-windows-to-launch-a-program-with-out-a-flash-of-cmd
I'm not sure if the other scripting languages can spawn a process without a brief shell command window flashing.
Update:
I got around the issue by switching to VBScript, not as ideal as Lua but at least got the job done:
Function ff(strIn)
ff = Chr(34) & strIn & Chr(34)
End Function
Function sendData(data)
Dim WSHShell
Dim RunIt
Set WSHShell = CreateObject("WScript.Shell")
RunIt = "E:\XNA Stuff\Client\bin\Release\Client.exe"
WSHShell.Run(ff(RunIt) & " " & ff(data))
End Function
sendData("sfsf ff ls sfs")
Another Update:
I'm currently doing some VBScript research, since I know even less about it than Lua to determine if I can cut the Client.exe out of the equation entirely. That is to define a connection to localhost 8012 via VBScript alone and send the string data via VBScript without using an auxiliary application like the above.
Yet another Update:
Since I new JScript far better than VBScript I decided to go that route. I altered my visualization to be an HTTPlistener instead of a generic TCPlistener so I could use some AJAX style stuff:
function send( data ) {
var server = new ActiveXObject("Msxml2.XMLHTTP.3.0");
server.open("POST","http://localhost:8012", true);
server.send(data);
}
With this in my script file I can always call this send function as often as I like to send as many async calls to my visualization http listener as I like. This rids the need of the client.exe and solves all my problems.
Now on to getting the triggers and regex's setup properly and send the correct data for visualizing.
EDIT:
OK my triggers are setup now, I went with the three trigger setup. Seems pretty good. Only thing was I wanted to store new lines in my string but \n or \0A wasn't doing the trick. Got some parse errors with \n stating unterminated string. |