Set Default Printer (SDP) version 1.50  Documentation
-----------------------------------------------------

What is it?

  SDP is a command line utility for setting which printer/output-device 
  is to be used by default under Windows 95, 98 and NT.  It will not run 
  under Windows 3.1.

Why did I make it?

  I had to make print outs every morning automatically using task scheduling 
  software using NotePad & WordPad using the little know /p command line 
  option.  (aside:  NotepPad /p SDP.TXT automatically loads, prints, and 
  closes this doc.)  However, if someone sent a fax or something the previous
  day, the print outs would go to the fax instead of the printer.  I needed
  A utility that would make the printer the default output every morning.  
  I created SDP and I set my scheduling software to run it before the morning
  print outs and... guess what?  No more problems.

How do you use it?

  The basic usage is:  SDP.EXE <printer description>
  
  Just type in all or part of the printer's name and/or port and SDP will
  select the first device that it matches.  The printer description is 
  CASE SENSITIVE!  Epson is not the same as EPSON to SDP.  You should run 
  SDP without parameters to see the case used.  Also do no use quotes or 
  chevrons (< >) on the command line, just what it asks for.  

  Example:  SDP.EXE Okidata

  Running SDP without parameters gives you the help screen that shows which 
  printers are installed (i.e. selectable) and their complete, case sensitive 
  description.  It displays the printer's name and port separated by a comma.
  You can enter this entire description as shown or any part of it.  If
  the printer description was:  HP LaserJet 4P,\\network\hp you could
  enter:  SDP.EXE 4P,\\net and SDP would find it.
  
  SDP can be run from a DOS window, a DOS batch file, the Run command on the
  Start Menu or you can create a shortcut with the <printer description> 
  after the program's name.  From a DOS batch file, it's a good idea to use 
  the START command with the /w wait option.

  Example:  START /W SDP.EXE Epson

  * Note:  Windows NT users should not use the START command if they
           intend to use SDP errorlevel setting feature.

  This will cause the DOS batch file to wait until SDP is done setting the
  default printer before continuing with the next command.

  If SDP finds the printer used in the <printer description> it does the 
  setting and displays a Success message for a default time of 5 seconds, 
  closing itself afterwards.  The "Success Window" default time can be 
  changed using the Configure Dialog located on the System Menu in the
  upper left hand corner of the window.  It can also be set by editing
  the SDP.INI file, which needs to be in the same directory as the SDP
  program.  It can even be set to not display a window!  If the printer 
  could not be found, the printer was found and the setting failed, or 
  if there was no parameters, SDP does not automatically close itself.
  To create a SDP.INI file, you only need two lines:

  [delay]
  timeout=5
 
  The timeout setting is measured in seconds.  Setting the timeout=0 
  keeps the Success window from being displayed.  Setting the timeout
  at 10 prevents the "Success Window" from closing by itself.  You can
  prevent ANY window (i.e. error & not found messages) from being
  displayed by adding:

  [delay]
  timeout=0
  no_window=1

  By doing this, the user will have to change no_window=0 by manually 
  editing SDP.INI if they wish to have windows displayed, such as the
  configuration menu.

  For those users that want to run this from a batch or script file,
  SDP sets the errorlevel at exit as follows:

    ERRORLEVEL    RESULT
    ==========================================
        0         Error or General Failure
        1         Success
        2         Printer Not Found
        3         No Parameters Given

  At sample batch file (ERRORLVL.BAT) is included to demonstrate how to
  use errorlevel reporting.

  ** A special section is included below for Windows NT users.
  
How does it work?  (for the curious)

  SDP was created using Microsoft Visual C++ 5.0 with standard Win32 API
  calls.  It uses EnumPrinter, OpenPrinter and SetPrinter functions to
  do most of the dirty work.  Source code is available from the web site.

Licensing B.S.

  This is FREEWARE (my favorite kind of software) so if you paid for it, 
  you got taken.  It is designed to work under Windows 9x/NT.  I have 
  tested it under Windows 95, 98 and NT Workstation.  I have found it
  to be completely safe, but like all software, use at your own risk.
  I make no guarantees, and none should be implied.  If you're the worrying
  sort, use the standard precaution:  backup first.

What about support?

  As with most freeware, support is very limited.  If you've got a bug to
  report or a comment, my email address is:  
  
  Edward Brophy
  ebrophy@aztec.asu.edu                  ("old reliable")
    -or-
  faustic@surf.to

  Visit --> http://surf.to/faustic       (new redirection service)
  for possible updates, source code for SDP and additional freeware!


History:

    9/8/98  Version 1.0  

            Initial release.


   11/5/98  Version 1.1  

            Added features:  Due to requests, added a way of controlling
                             how long the window stays open.  See the
                             SDP.INI file for instructions.  This only
                             effects the "Success" window.
  
            Added extra command line checking so that SDP can be run 
            from shells, scripts and other applications.
 
            Tested SDP under Windows 98.


  11/18/98  Version 1.2

            Bug fix for page fault error via DOS shell execution.


    4/3/99  Version 1.3

            Major rewrite of the printer setting code.  SDP no longer
            uses WIN.INI so as to make it more NT compatible.  Also 
            dropped the ability to select printer based on the printer's
            driver name in order to simplify code.  Only the printer's
            name and port descriptions used now.


    4/5/99  Version 1.31

            Minor display bug fix.


   1/27/00  Version 1.40

            Finally, able to do debugging using Windows NT.  Fixed 
            transparent window problem under NT.  Using the latest
            Microsoft recommended method for setting the default 
            printer under Windows NT.
            Added a Configuration and About dialog window.  No more
            need to edit the SDP.INI file.
            Also added a Special Windows NT Settings dialog window
            to let NT Administrators tweak the printer finding
            methods used by SDP.  (see below)
            Included error number reporting and changed the colors
            used for the main window to a more universal set.


   10/1/00  Version 1.50

            Added option to not display ANY window.
            Finally supporting errorlevel setting.  (see above)
            Improved command line parsing for Windows NT.
            Fixed a bug that prevented SDP from closing under
            certain circumstances.  General source code cleanup.


Windows NT Section

  SDP was originally intended to select local printers only.
  Windows 95 and 98 treat network printers for most purposes as
  local printers, no problem.  Windows NT does not.
  Windows NT makes it very difficult to get a list of available
  printers on a network.  SDP was given a "Special Windows NT
  Settings" dialog window to assist NT Administrators.
  The options are:

     Local Printers
       This gives a list of the printers directly connected to 
       the computer running SDP.

     Priorly Connected Network Printers
       This *should* list printers that have already been used
       during the currect session.  If you haven't printed to 
       a particular network printer before, it probably won't be
       listed.  The first time a remote printer is used, the
       operating system requests all the necessary files and 
       drivers to use the remote printer.  Remote printers that
       have never been printed to by computer running SDP, lack
       the automatic first-use printer setup.
       This option also assumes that the printer is setup as a
       shared resource.

     Network Printers Listed by Name
       This option requires the name of the Print Provider and/or
       the Network's Domain name.  A specific machine's name can 
       also be included.  An example of this option is included
       on the window.  If nothing is entered in the name box,
       SDP *should* display a list of Print Providers.  This may
       or may not work.  This is from the EnumPrinters() function
       documentation for NT settings:

       "Print Provider"            returns -> All domain names 
       "Print Provider!Domain"     returns -> All printers and print
                                              servers in the computers
                                              domain 
       "Print Provider!!\\Machine" returns -> All printers shared at
                                              \\Machine 
       An empty string, ""         returns -> All local printers
 
       I don't have an NT network to test it on, just one machine so
       you will need to tinker a bit here.  You can try searching the
       Internet for phrases like, PRINTER_INFO_2, PRINTER_ENUM_NAME or
       EnumPrinters for extra help.  This option is versatile but 
       requires trial and error to make it work.  Text entered into
       the name box may or may not need to be case sensitive.

  The options above can be combined.  One or all can be selected.

  **A note for Windows NT users, do not rename SDP.EXE as the program
  uses the name of the program itself (SDP) in parsing the command line.


The "If all else fails..." Section

  If SDP doesn't work out for you, there are other software utilities
  out there that may fit the bill.  Here are some utilities that might
  work:

    KiXtart
      KiXtart is a freeware logon script processing utility for Windows 
      NT.  With KiXtart, you can conditionally display information, set
      environment variables, start programs, connect to network drives 
      and/or change the current drive and directory using a free format 
      'script language'.  Although the program is intended to be used 
      as a logon script processor, it can also be used as an enhanced 
      batch language. (for example on Basic workstations)
      Users say you can set the default printer using KiXtart.
      It can be found at:
        http://netnet.net/~swilson/kix/

    Nadio InternetPrint Lite 2.0
      Print to remote printers.  Worth a look and the Lite version may
      still be free.  It can be found at:
        http://www.nadio.com/iprintn/

    Zero Administration Kit for Windows
      ZAK is  a set of Microsoft tools for IT managers that runs on
      Windows 95, 98 and NT Workstation.  In this set of tools is a 
      utility called CON2PRT which can set the default printer.  The 
      website for ZAK is:
        http://www.microsoft.com/windows/zak/

  I haven't tested any of these utilites.  They are merely free 
  utilities that users of SDP have mentioned as useful in the past.