DataEase 8.5 - Function Update GetCurrent("@PrinterN") & SetState("@DefaultPrinter","PrinterName") Ver. 8.5.0.1790
Dedicated printing has always been a problem in Windows and particularly in DataEase for Windows.
It was simple to direct output to a specified printer for a given report/procedure in DFD but in Windows "user interaction" has been the way, which is very annoying when one want invoices to go to a certain printer and letters to another etc.
We implemented Application/Workstation Printers again in 8.0 which made it possible to direct output to 4 virtualised printer names in your app.
At the same time we introduced PrintMemo() and PrintHMTL() which only printed to your default printer with the promise to "fix" this at a later stage.
The reason we didn't fix it first time around is because we use IE for Web/HTML printing and it is close to impossible to force it to do what you want.
With the introduction of Body to ExecDQL we simply needed to get control of this situation, but the only "workable" way to achieve what we want is to change the default printer.
So we have added the keyword: @DefaultPrinter to SetState.
So this call will change the default printer to HP Laserjet 4500
SetState("@DefaultPrinter","HP Laserjet 4500")
Remember that the name need to match 100% the name in your Printers list on the current workstation.
Since we have the 4 workstation printers you can call GetCurrent("@PrinterN") to get the name set for them.
SetState("@DefaultPrinter",GetCurrent("@Printer4"))
Will set the default printer to workstation printer 4.
You can also use GetCurrent("@DefaultPrinter") to find out what the current default printer is.
Enjoy!