0

I have a SAS program I would like to schedule, so we don't have to run it manually.

In the program we call an excecutable (reg.exe), like this:

X CALL "K:\reg.exe"; 

The executable opens a standard windows save-dialog and all we need to do is press save, which will save an xml-file. The save-dialog already opens in the correct directory.

What I would like is to somehow pass the instruction on, using code, to "press save", so the program can move on and work with the saved xml-file.

Is this possible somehow?

Thanks for your help!

ThomasTN
  • 3
  • 1
  • I don't think it's possible to send a command save to the reg.exe. It's only possible if the program has been build to behave in this way. Like in this example : https://stackoverflow.com/questions/16727941/how-do-i-execute-cmd-commands-through-a-batch-file – Thogerar Nov 15 '17 at 13:53
  • I think you'd need to involve some other 3rd party program that would record a keyboard macro. Many testing suites support this kind of behaviour. What you want to do is possible. Just probably not from SAS. – Robert Penridge Nov 15 '17 at 15:59

1 Answers1

0

Thomas:

There are numerous Windows utilities for scripted control of an interactive program. For example: AutoIt (my favorite), MouseRobot and AutoHotKey to name a few.

The statement

options xmin noxwait noxsync;

will cause the external program to run, not wait for the command session to exit, and not wait for the command to complete.

If your SAS programs needs to wait for the side effects of the scripting use of reg.exe to occur before occurring, use:

options xmin noxwait xsync;

These settings affect other operating system interfacing features, such as:

  • X command
  • CALL SYSTEM routine
  • %SYSEXEC statement

The use of your reg.exe might require your login to have admin rights.

The SYSTASK statement can also run external commands.

If you find that you are unable to run external commands, it is probably because the system setting NOXCMD is active. This setting is on by default in SAS server environments.

Richard
  • 25,390
  • 3
  • 25
  • 38