function ReportsCleanUp() local reports[1], n, s, j, lines, newexpr, t, KeepLine s = select(0) select 0 n = adir(reports, '.\Report\*.??x') t = therm(n, 'Cleaning up reports...') for i = 1 to n if( !inlist(justExt(reports[i,1]), 'FRX', 'LBX') ) loop endif =t.update(i, juststem(reports[i,1])) use ('.\' + reports[i,1]) excl go top locate for (ObjType = 1) and (ObjCode = 53) assert found() lines = memlines(expr) newexpr = '' for j = 1 to lines do case case at('DRIVER=',mline(expr,j)) == 1 KeepLine = TRUE case at('ORIENTATION=',mline(expr,j)) == 1 KeepLine = TRUE case at('PAPERSIZE=',mline(expr,j)) == 1 KeepLine = TRUE case at('COPIES=',mline(expr,j)) == 1 KeepLine = TRUE otherwise KeepLine = FALSE endcase do case case KeepLine newexpr = newexpr + mline(expr,j) + chr(13) + chr(10) endcase endfor if( empty(at('DRIVER', newexpr) ) ) newexpr = 'DRIVER=winspool' + chr(13) + chr(10) + newexpr endif repl expr with newexpr, tag with '', tag2 with '' pack use do case case inlist(justExt(reports[i,1]), 'FRX') compile report ('.\' + reports[i,1]) case inlist(justExt(reports[i,1]), 'LBX') compile label ('.\' + reports[i,1]) otherwise assert FALSE endcase endfor select (s) endfunc *--------------------------------------------------------------------------(2) If you use set printer to name (xxx) than this is imo most likely to be the cause. Once this has been done you will start getting that error 1958.
&& to change the printer local sPrint =Printer_Set('PrinterNameIwantToUse', @sPrint) && this.Parent.PrinterList.Value : combo box with selected printer && print && to reset the printer =Printer_Set(sPrint) && functions *------------------------------------------------------------------------------- function Printer_Get() return WindowsPrinter_Get() endfunc *------------------------------------------------------------------------------- function Printer_Set(PrinterNew, PrinterOld) =WindowsPrinter_Set(PrinterNew, @PrinterOld) endfunc *------------------------------------------------------------------------------- function WindowsPrinter_Get() return set('Printer', 2) endfunc *------------------------------------------------------------------------------- function WindowsPrinter_Set(PrinterNew, PrinterOld) local wsh, sError sError = on('error') PrinterOld = WindowsPrinter_Get() do case case lower(PrinterOld) <> lower(PrinterNew) wsh = CreateObject('WScript.Network') private HadError HadError = FALSE on error HadError = TRUE wsh.SetDefaultPrinter(PrinterNew) on error &sError wsh = Null return !HadError endcase endfunc *-------------------------------------------------------------------------------Success,