cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Check out the JMP® Marketplace featured Capability Explorer add-in
Choose Language Hide Translation Bar
Botzal
Level III

How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Hi All,

I'm trying to run batch file automatically every day when radio button -"run whether user is logged on or not"  is selected and it doesn't work.
It works only when radio button "run with the user logged on" is selected.
Can you advise please?

Thank you

13 REPLIES 13
SDF1
Super User

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Hi @Botzal ,

 

  If you have a separate system batch file that can open a JSL file -- i.e. double click it, then you should be able to run the JSL file automatically. If the very first like of your JSL code is the following //! then once you save and close the file, if you double click it, then it runs the JSL code, but doesn't open the file for editing. If your batch file can open it, I believe it should work, but I have not tried that myself.

 

Hope this helps!,

DS

Botzal
Level III

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Hi @SDF1 
I know and understand your explanation, but that's not what I mean.
My intention was,
How I schedule the script (Using the task scheduler) that will run every morning even when I sign out of computer.
The JMP script should not work interactively.
Thanks

ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

What does happen when you try to manually start the task with 'run whether user is logged on or not' checked.  Does it show an error?  Does JMP start and then close (you would need to watch the task manager as the window will not open)?

 

I sometimes need to uncheck everything on the conditions tab to fix some errors that looked like permissions issues.

Botzal
Level III

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Hi @ih ,

When I try to run it manually it opens a CMD and JMP process (in task manager) and it's stuck on running status.

In addition, I tried to uncheck everything in condition tab, it is still didn't work.
Do you have any other advice please?
Thx

Botzal_0-1648026878463.png

Botzal_1-1648026917168.png

 

ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Since JMP did start I would focus on your script.  Perhaps start with something very simple like what is below.  Remember all of your outputs need to be written to a file, you will not have access to any windows or reports opened by your script.

 

Run this interactively first and make sure you have access to write to the file, then delete the csv file and try running it through the task scheduler:

 

//!

dt = New Table( "Untitled",
	Add Rows( 1 ),
	New Column( "test", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1] ) )
);

dt << Save As( "C:/test.csv" )
Botzal
Level III

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

@ih 

I tried to do this, it does not work
It also opens a CMD and JMP process (in task manager) and it's stuck on running status.

jthi
Super User

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

Add

Exit(No save);

or

Quit(No save);

to end of the jsl script you try to run to close the JMP instance

-Jarmo
Botzal
Level III

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

@jthi,

of course, I added to the script... doesn't work.

ih
Super User (Alumni) ih
Super User (Alumni)

Re: How to run a script automatically - Task scheduler cannot run batch file (run whether user is logged on or not)?

To clarify, when you say it does not work, does that mean the file IS created when the task is set to run when the user is logged on and you manually start the task, and it is NOT created when set to run whether the user is logged in or not and you manually start the task?