cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Choose Language Hide Translation Bar
baiyun
Level I

CMD window for logging never shows up while using RunProgram

I got an issue while using "RunProgram" to call my exe, a CMD window for logging is supposed to appear, but it never shows up. 

The CMD window can normally pop up when I manually run it. Is there anyone who can help me solve the issue? Thanks in advance : ) 

 

JSL code:

RP = Run Program(
    Executable(
        exefilepathRoot || "CommonalityEngine\PyScript\get_data_from_cache.exe"
    ),
    Options( Char( CAEngine_Main:ConfigFileName ) ),
    ReadFunction( "text" )
);

CMD window can show up while manually running without JSL:

baiyun_0-1615185404199.png

 

 

4 REPLIES 4
ih
Super User (Alumni) ih
Super User (Alumni)

Re: CMD window for logging never shows up while using RunProgram

Hi @baiyun,

 

What are you hoping to do with that window once it opens? The Run Program feature intentionally doesn't show the user interface as it is intended to let you control that program entirely via scripting.  Most likely, what you want to do in that CMD window, you would instead do in JMP, and let JMP pass those instructions to the program via read and write functions.

This link might help you get started:
https://www.jmp.com/support/help/en/15.2/jmp/run-external-programs.shtml

 

Craige_Hales
Super User

Re: CMD window for logging never shows up while using RunProgram

yes, we need a bit more information. Do you interact with get_data_from_cache.exe? Does it open other windows? Does it need to receive an end-of-file of some sort?

The RP variable might already hold the text that would appear in the CMD window, try

write(rp);

and see if that's what you want. 

If you need to type something in the window, RunProgram's writeFunction can supply the text.

Alternatively, you might want to run CMD.EXE and pass it the name of the program to run.

 

Craige
baiyun
Level I

Re: CMD window for logging never shows up while using RunProgram

Hi ih,
Thanks for your solution. I want the user to see that window because there is log printed on that window.
ih
Super User (Alumni) ih
Super User (Alumni)

Re: CMD window for logging never shows up while using RunProgram

It sounds like @Craige_Hales might be right then in that your variable rp might already have that log info.  Try running this:

 

names default to here(1);
RP = Run Program(
    Executable(
        exefilepathRoot || "CommonalityEngine\PyScript\get_data_from_cache.exe"
    ),
    Options( Char( CAEngine_Main:ConfigFileName ) ),
    ReadFunction( "text" )
);
New Window("Output", text box(RP));

Or, here is an example anyone on windows can run:

 

names default to here(1);
rp = Run Program(
	Executable( "cmd.exe" ),
	Options( {"/c", "TaskList\!n"} ),
	Read Function( "text" ) // returns all text
);
New Window("Output", text box(rp));