cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Browse apps to extend the software in the new JMP Marketplace
Choose Language Hide Translation Bar

Can JMP call a DOS Exe

by dos exe I just mean a standard windows/dos command line app that would run in a xp command window.
1 ACCEPTED SOLUTION

Accepted Solutions

Re: Can JMP call a DOS Exe

Just found this out today. The "web" command can run command line items:
e.g.
web("bob.exe");

I just tried it with a perl script and it worked, too.

View solution in original post

18 REPLIES 18

Re: Can JMP call a DOS Exe

After a quick google search I couldn't find anything for you. I don't remember seeing anything like that in the scripting guide either. What are you trying to do, maybe there's more than one way to do it.

Re: Can JMP call a DOS Exe

If you also have SAS, you can write a JSL script that connects to SAS and then you can run DOS commands using the X command.

1) Connect to SAS using File->SAS->Server Connections
2) Write a JSL script:

------------
conn = CurrentSASConnection();

code = EvalInsert(
"\[
X '"C:\Program Files\Microsoft\Office12\EXCEL.EXE"'
\]");

SAS Submit(code);
---------------------

That would open up Excel using a DOS command through running SAS in the background.

Re: Can JMP call a DOS Exe

Just found this out today. The "web" command can run command line items:
e.g.
web("bob.exe");

I just tried it with a perl script and it worked, too.
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Can JMP call a DOS Exe

Great find! I tried with an Applescript app and it worked perfectly. That opens up a range of possibilities.

However, the path must be in URL-style, like web("file:///Applications/JMPtest.scpt"), at least on the Mac.

Re: Can JMP call a DOS Exe

On Windows I actually entered the directory like: web("c:\blah\blah.exe"). Not sure if it makes a difference, but I'm using JMP 8.
ms
Super User (Alumni) ms
Super User (Alumni)

Re: Can JMP call a DOS Exe

I am also using JMP 8. Probably an OS thing, reflecting differences in how paths can be entered in a browser.

Re: Can JMP call a DOS Exe

Actually, a more direct way to call any .exe file is via the Open("/path/to/my/app.exe") statement. Normally JMP expects a JMP, .txt, or .xls Excel file to open up within JMP. But if it encounters a unrecognized file type in the Open() statement (such as .bat, .exe, or .gif) then it defers execution to the operating system using default file type associations.

For example, if you specify a path to your .gif or .bmp image file, the image will be opened up (externally of JMP) using your default image viewer. A .bat file will be executed from a DOS shell (you will probably see a quick flash and disappearance of the black DOS shell window).

So you can write a .bat file to execute any DOS command, and call the .bat file from your JSL script.
dghidoni
Level II

Re: Can JMP call a DOS Exe

as deeper info to anyone interested:

it works, but in this way you can't pass parameters to the bat file.

Also it seems to execute it in a directory that could be different from the one in which the script is: I had some strange behaviour, but I had cmd.exe open and I didn't pursue it further since I changed my approach, maybe it was only a glitch or my fault.

anyway, if for someone these are issues (like for me) i recommend to create and execute the bat file from inside the jsl:

riga1 = "@echo off";

riga2 = "\!Ncd C:\Users\JRR\Documents\sandbox\v2.2_bat";

riga3 = "\!Ndir>urano.txt";

Save Text File(    "test_batch_write_file_selfmade.bat", riga1, mode ("replace"));

Save Text File(    "test_batch_write_file_selfmade.bat", riga2, mode ("append"));

Save Text File(    "test_batch_write_file_selfmade.bat", riga3, mode ("append"));

open ("test_batch_write_file_selfmade.bat")

in this way you can create a hardwired bat file using variables from jmp, and be sure on where it will be executed

blackeneth
Level III

Re: Can JMP call a DOS Exe

I would also like to point out the use of \!N in dghidoni's example.

compare:

SaveTextFile( "C:\Temp\cmddir.bat", "echo \!"directory list\!"\!N

dir\!N

pause\!N", mode("replace")) ;

to

SaveTextFile( "C:\Temp\cmddir.bat", "echo \!"directory list\!"

dir

pause", mode("replace")) ;

The first one (with \!N) works, the second one doesn't. Your text editor may not display the difference. But if you run cmd.exe and then type:

cd c:\temp

type cmddir.bat

you will see the difference.