Oh darn, that will be a problem... Oh well, let's tackle it one at a time lol.
I have decided not to use the command line directly, but rather just execute a batch file. My code right now is this:
jscript code:
function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind)
{
if (Message.indexOf("$$") != -1)
{
var fso = new ActiveXObject('Scripting.FileSystemObject');
// -----------------
// Create .tex file
// -----------------
var texFile = fso.CreateTextFile(path + "\\file.tex", true);
texFile.WriteLine("\\documentclass{article}\n\\pagestyle{empty}\n\\begin{document}\n");
// Replace all $$ with $
var texCode = Message.replace(/\$\$/g, "$");
texFile.WriteLine(texCode);
texFile.WriteLine("\n\\end{document}");
texFile.Close();
// -----------------
// Create DVI file and PNG file
// -----------------
var batFile = fso.CreateTextFile(path + "\\batFile.bat", true);
batFile.WriteLine("cd " + path);
batFile.WriteLine("latex file.tex");
batFile.WriteLine("dvipng -T tight -x 1200 -z 9 file.dvi");
batFile.Close();
var shell = new ActiveXObject('WScript.Shell');
shell.Run(path + "\\batFile.bat");
}
}
(path is the ScriptFilesPath)
It creates the .tex (latex) file with the correct equation and text, and then creates the batch file with three commands that will convert the tex file into a dvi, and then into a png image file.
(Of course, you need something like MikTex installed for this to work!)
However, the batch file is not running. I just guessed that I could run it with the Run command but apparently not... How do I run it?