/* * * * * * * * * * * * * * * * * * */ /* CheckPrn */ /* Check selected printer settings */ /* and start Add New Printer Wizard */ /* if necessary */ /* */ /* Written by Rob van der Woude */ /* Version 4.02 */ /* Latest Revision: 1999/09/04 */ /* * * * * * * * * * * * * * * * * * */ /* Valid printer descriptions */ valid.0 = 2 valid.1 = "HP LaserJet III PostScript" valid.2 = "\\NTPS" /* Initialize */ "@ECHO OFF" ok = 0 /* Read client name and default printer from registry */ hkey = "HKEY_CURRENT_USER" subkeyname = "Printers" subkeyhandle = w32RegOpenKey( hkey, subkeyname ) printer = w32RegQueryValue( subkeyhandle, "DeviceOld" ) clientname = w32ExpandEnvironmentStrings("%CLIENTNAME%") username = w32ExpandEnvironmentStrings("%USERNAME%") call w32RegCloseKey subkeyhandle /* Display current settings */ parse value printer with client"#"prndescr",". "CLS" say say "Clientname : "||clientname say "Selected printer : "||client||"#"||prndescr /* Check if default printer is valid */ if clientname <> client then call Wizard do i = 1 to valid.0 pdlength = length( valid.i ) if left( prndescr, pdlength ) = valid.i then ok = 1 end if ok = 0 then call Wizard EXIT 0 /* Procedure to display message and start Add Printer Wizard */ Wizard: "CLS" say say "Clientname : "||clientname say "Selected printer : "||client||"#"||prndescr "START /MIN /W MSG.EXE "||username||" /W You should create a new printer object" "START /MIN RUNDLL32 SHELL32.DLL,SHHelpShortcuts_RunDLL AddPrinter" EXIT 1 return