What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Basic Questions - LaTeX

Basic Questions - LaTeX
Author: Message:
CookieRevised
Elite Member
*****

Avatar

Posts: 15517
Reputation: 173
– / Male / Flag
Joined: Jul 2003
Status: Away
RE: Basic Questions - LaTeX
You could debug that code yourself by stripping down the command line and testing it part by part... starting with the CD command...

Doing this it shows two things:

- You get the error because you start your command line with an internal DOS command (the CD command). Apparently you can't use the Run method to run an internal DOS command since the Run method does not start a DOS interpreter on its own.

The reason normal programs work is because they are executables. An internal DOS command isn't an executable, but is actually part of the DOS interpreter.

This can be solved by starting the interpreter yourself like so:
    cmd /c cd c:\blahblah

- Second, you forgot to enclose long path and file names with quotes:
    cd "c:\Program Files\Messenger Plus!\etc"

So, your command line in the script should be:
jscript code:
var cmd = "cmd /c cd \"" + path + "\" & " +
                "latex file.tex & " +
                "dvipng -T tight -x 1200 -z 9 file.dvi";
And that will work...

However, for testing and debugging purposes you could temporarly do two things:

- change "cmd /c" to "cmd /k". This will keep the command window open and gives you the chance to actually see and check the output (more info on this if you type cmd /? in the interpreter). You must type "exit" to close the window and continue the script!

- change the second parameter of the Run method to 1, so the command window isn't hidden.

Thus for testing purposes, you could use:
jscript code:
var cmd = "cmd /k cd \"" + path + "\" & " +
                "latex file.tex & " +
                "dvipng -T tight -x 1200 -z 9 file.dvi";

var oShell = new ActiveXObject('WScript.Shell');
oShell.Run(cmd, 1, true); 
oShell = null;
and when everything works ok, you change it to:
jscript code:
var cmd = "cmd /c cd \"" + path + "\" & " +
                "latex file.tex & " +
                "dvipng -T tight -x 1200 -z 9 file.dvi";

var oShell = new ActiveXObject('WScript.Shell');
oShell.Run(cmd, 0, true); 
oShell = null;

;)


PS: however, note that using the CD command to work around the dvipng limitation (you are absolutly sure you can't provide absolute paths in some way to dvipng, or set the input path to the script folder?) could cause a failure in case the script (and Plus!) wasn't installed on the default Windows drive.

The command "CD C:\blahblah" will not change the current drive to C. It will only change the path on the C-drive. So, if the current drive is D, the whole command line will fail again.

This is also easly solved by simply adding the command "C:" right before the "CD" command:
    cmd /c C: & CD "c:\blahblah" & etc...

or:
jscript code:
var cmd = "cmd /c " + path.substring(0, 2) + " & cd \"" + path + "\" & " +
                "latex file.tex & " +
                "dvipng -T tight -x 1200 -z 9 file.dvi";
This also applies in the same way if you use batch files or whatever though!. So you see, in the end, and to come back to your question of "why?", if you want to make things bug proof, using an absolute path name and using the proper command line parameters is much easier and way more efficient and shorter than using batch files and trying to work around all sorts of stuff like external files. (Provided the tools do support the needed parameters of course. Otherwise you are forced to use a workaround. But in that case you still should use the most efficient workaround - which batch files are certainly not).

This post was edited on 06-18-2009 at 03:14 AM by CookieRevised.
.-= A 'frrrrrrrituurrr' for Wacky =-.
06-18-2009 01:42 AM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Basic Questions - LaTeX - by Flippy on 06-17-2009 at 09:14 AM
RE: Basic Questions - LaTeX - by ryxdp on 06-17-2009 at 09:26 AM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 09:48 AM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:01 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 10:11 AM
RE: RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:14 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 10:17 AM
RE: RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:25 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 10:30 AM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:37 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 10:51 AM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:59 AM
RE: Basic Questions - LaTeX - by Matti on 06-17-2009 at 12:07 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 12:23 PM
RE: Basic Questions - LaTeX - by Matti on 06-17-2009 at 01:49 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 02:41 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 03:07 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-17-2009 at 05:54 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 06:14 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-17-2009 at 06:36 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 07:38 PM
RE: RE: Basic Questions - LaTeX - by CookieRevised on 06-17-2009 at 08:27 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 08:32 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 08:38 PM
RE: Basic Questions - LaTeX - by NanaFreak on 06-17-2009 at 09:02 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-17-2009 at 09:27 PM
RE: Basic Questions - LaTeX - by Flippy on 06-17-2009 at 10:01 PM
RE: Basic Questions - LaTeX - by foaly on 06-17-2009 at 10:42 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-18-2009 at 01:42 AM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 11:29 AM
RE: Basic Questions - LaTeX - by NanaFreak on 06-18-2009 at 11:43 AM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 12:03 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 01:29 PM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 01:52 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 03:32 PM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 03:56 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 04:21 PM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 05:33 PM
RE: Basic Questions - LaTeX - by matty on 06-18-2009 at 05:36 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 05:47 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 06:11 PM
RE: Basic Questions - LaTeX - by Spunky on 06-18-2009 at 07:11 PM
RE: Basic Questions - LaTeX - by Matti on 06-18-2009 at 07:22 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 07:23 PM
RE: Basic Questions - LaTeX - by Flippy on 06-18-2009 at 08:10 PM
RE: Basic Questions - LaTeX - by CookieRevised on 06-19-2009 at 09:14 AM
RE: Basic Questions - LaTeX - by Matti on 06-19-2009 at 01:43 PM
RE: RE: Basic Questions - LaTeX - by CookieRevised on 06-19-2009 at 10:24 PM
RE: Basic Questions - LaTeX - by Flippy on 06-19-2009 at 02:31 PM
RE: Basic Questions - LaTeX - by sabian2008 on 07-30-2009 at 03:38 PM
RE: Basic Questions - LaTeX - by Flippy on 07-30-2009 at 04:36 PM
RE: Basic Questions - LaTeX - by sabian2008 on 08-07-2009 at 01:01 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On