Common Sculptor technical questions

Redirect sagerep output to a printer from a DOS shell under modern version of windows

Older versions of the DOS shell allowed printer redirection of program output. For example:

sagerep test > prn

would send the output to the standard printer. Later version of the DOS shell supplied with windows do not support this. There are some commercial add-ons that can restore this functionality but the simplest thing to do is to make use of a power shell script.

For Sculptor 2 programmers still working with DOS who wish to continue using printer redirecton of sagerep output, the easiest thing to do is put the sagerep command in a Power Shell script and call Power Shell itself with the script as parameter from a DOS shell. It is not usually workable to dispense with a DOS shell altogether in favour of a Power Shell because the 'exec' command and command lines in menu files do not work. Sculptor attempts to call another DOS shell to execute commands.

The procedure then is:

  1. Create a Power shell script, say test.ps1, and use the power shell printer redirect facility with optional command line parameters $args[]:
    # test.ps1 - send sagerep output to a named printer using three application level parameters
    sagerep test nullp $args[1] $args[2] $args[3] | out-printer -Name "HP14398D (HP DeskJet 2700 series)"
    The -Name clause may be omitted if you want to use the default printer.
  2. From an exec command in a Sculptor program call a power shell with test.ps1 as a parameter along with your own optional application parameters, eg:
    exec "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -File test.ps1 AAA BBB CCC"
    This type of command executed by exec should also be used with menus.