-
Posts
8 -
Joined
-
Last visited
averlon's Achievements

Seeker (1/7)
1
Reputation
-
mLipok reacted to a post in a topic: set printer configuration
-
I found a solution. Not the very best, but it seems to work. There is a Microsoft Tool where you can store the printers configuration in a .dat-file. This is what you need to do only once, naturally when the printer settings are according to your needs - duplex: "Installed" - in my case. rundll32.exe printui.dll,PrintUIEntry /Ss /n"<printer name>" /a"<some path to file>\printer_configuration.dat" d You can do this via WINDOWS+R and past the command into the commandline field and ENTER. Now, you have the printer configuration stored in the file specified! Now you can create a autoit script and run the script at "autostart". Run('rundll32.exe printui.dll,PrintUIEntry /Sr /n"<printer name>" /a"<some path to file>\printer_configuration.dat" d') This will restore the configuration to the settings you stored with the commandline shown above. For more information on the printerui see https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/rundll32-printui#related-links So far, I havn't found any way to modify one specific printer property. So the only way is to store and restore the whole configuration!
-
O.K. - what I assumed. All work here was for nothing. Anyhow. Since I can set the duplex unit via the printer configuration GUI of Windows, I should be able to do the same via autoit. I will try to find a way! Thanks for support!
-
unfortunately it still does not work! Befor Script: Script: #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <String.au3> #include <Array.au3> #include <Printer_UDF.au3> #include <WinAPIGdi.au3> #include <WinAPIDiag.au3> Opt("MustDeclareVars", True) Example() Func Example() ConsoleWrite("--- START ---" & @CRLF) Local $hPrinter = _PRNT_OpenPrinter("HP Color LaserJet CP202X PS Class Driver") Local $tDevMode = _PRNT_GetPrinterInfo($hPrinter, True) ConsoleWrite("Orientation: " & $tDevMode.Orientation & @CRLF) ConsoleWrite("PaperSize: " & $tDevMode.PaperSize & @CRLF) ConsoleWrite("PaperLength: " & $tDevMode.PaperLength & @CRLF) ConsoleWrite("PaperWidth: " & $tDevMode.PaperWidth & @CRLF) ConsoleWrite("Scale: " & $tDevMode.Scale & @CRLF) ConsoleWrite("Copies: " & $tDevMode.Copies & @CRLF) ConsoleWrite("DefaultSource: " & $tDevMode.DefaultSource & @CRLF) ConsoleWrite("PaperWidth: " & $tDevMode.PaperWidth & @CRLF) ConsoleWrite("Color: " & $tDevMode.Color & @CRLF) ConsoleWrite("Duplex: " & $tDevMode.Duplex & @CRLF) ConsoleWrite("YRresolution: " & $tDevMode.YRresolution & @CRLF) ConsoleWrite("TTOption: " & $tDevMode.TTOption & @CRLF) ConsoleWrite("Collate: " & $tDevMode.Collate & @CRLF) ConsoleWrite("FormName: " & $tDevMode.FormName & @CRLF) ConsoleWrite("is valid DevMode: " & _PRNT_IsValidDevmode($tDevMode) & @CRLF) Local $aList = _PRNT_EnumJobs($hPrinter) ConsoleWrite("---aList: " & _ArrayToString($aList) & @CRLF) _PRNT_SetPrinterInfo($hPrinter, $DM_DUPLEX, 2, False) Local $tDevMode = _PRNT_GetPrinterInfo($hPrinter, False) ConsoleWrite("--- after SetPrinterInfo ---" & @CRLF) ConsoleWrite("Duplex: " & $tDevMode.Duplex & @CRLF) _PRNT_ClosePrinter($hPrinter) EndFunc ;==>Example Console Print: --- START --- Orientation: 1 PaperSize: 9 PaperLength: 2970 PaperWidth: 2100 Scale: 100 Copies: 1 DefaultSource: 15 PaperWidth: 2100 Color: 2 Duplex: 1 YRresolution: 0 TTOption: 3 Collate: 1 FormName: A4 is valid DevMode: 1 ---aList: 0|||||||||| --- after SetPrinterInfo --- Duplex: 2 >Exit code: 0 Printer configuration after Script: I have crosschecked the configuration with some application where I wanted to print a page (Word) and open the configuration before printing. Duplx printing is not offered! And by the way: I doubt, there are these options you mentioned. As far as I know, the type of duplex printing can be selected when printing. But what I am looking for is "to enable" duplex printing. So the configuration setting must tell me "Installed". At that configuration setting you don't have the option to select long- or short-page! As I stated above, this PowerShell-Script does the trick - but I don't want to enable PowerShell on my device! Set-PrinterProperty -PrinterName "HP Color LaserJet CP202X PS Class Driver" -PropertyName "Config:Duplexer" -Value "Installed" I have the feeling, we are talking about different type of settings.
-
I changed the script slightly: #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <String.au3> #include <Array.au3> #include <Printer_UDF.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $hPrinter = _PRNT_OpenPrinter("HP Color LaserJet CP202X PS Class Driver") Local $tDevMode = _PRNT_GetPrinterInfo($hPrinter, False) ConsoleWrite($tDevMode.Duplex & @CRLF) ConsoleWrite($tDevMode.FormName & @CRLF) ConsoleWrite(_PRNT_IsValidDevmode($tDevMode) & @CRLF) Local $aList = _PRNT_EnumJobs($hPrinter) ConsoleWrite(_ArrayToString($aList) & @CRLF) _PRNT_SetPrinterInfo($hPrinter, $DM_DUPLEX, 1, False) Local $tDevMode = _PRNT_GetPrinterInfo($hPrinter, True) ConsoleWrite($tDevMode.Duplex & @CRLF) ConsoleWrite($tDevMode.FormName & @CRLF) ConsoleWrite(_PRNT_IsValidDevmode($tDevMode) & @CRLF) Local $aList = _PRNT_EnumJobs($hPrinter) ConsoleWrite(_ArrayToString($aList) & @CRLF) _PRNT_SetPrinterInfo($hPrinter, $DM_DUPLEX, 1, True) _PRNT_ClosePrinter($hPrinter) EndFunc ;==>Example The console output is: 1 A4 1 0|||||||||| 1 A4 1 0|||||||||| >Exit code: 0 Question: Does "ConsoleWrite($tDevMode.Duplex & @CRLF)" only show, that the device has the option "Duplex", but not, whether it is enabled or not!? Beside all this: _PRNT_SetPrinterInfo($hPrinter, $DM_DUPLEX, "Installed", True) does not bring any error (with the Original UDF), although $iValue is !!not!! and Integer! Where based on my knowledge it shoud bring an error: If Not $hPrinter Or Not IsInt($iValue) Or Not BitAND($iProp, $PRINTER_AUTHORIZED_PROPERTIES) Or Not IsBool($bGlobal) Then Return SetError(1)
-
Hi, O.K. - it took some time to understand the way the UDF has to be used!!!! Anyhow, I don't get it working. #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <String.au3> #include <Array.au3> #include <Printer_UDF.au3> Opt("MustDeclareVars", True) Example() Func Example() Local $hPrinter = _PRNT_OpenPrinter("HP Color LaserJet CP202X PS Class Driver") Local $tDevMode = _PRNT_GetPrinterInfo($hPrinter, True) ConsoleWrite($tDevMode.Duplex & @CRLF) ConsoleWrite($tDevMode.FormName & @CRLF) ConsoleWrite(_PRNT_IsValidDevmode($tDevMode) & @CRLF) _PRNT_SetPrinterInfo($hPrinter, $DM_DUPLEX, 1, True) _PRNT_ClosePrinter($hPrinter) EndFunc ;==>Example The printer configuration shows still "Duplex = not installed". The "ConsoleWrite($tDevMode.Duplex & @CRLF)" shows "1". By the way: I found a way to configure the printer via Microsoft PowerShell. Set-PrinterProperty -PrinterName "HP Color LaserJet CP202X PS Class Driver" -PropertyName "Config:Duplexer" -Value "Installed" Here the value to be set is "Installed" - and this works! Therefore I tried to modify the UDF Func _PRNT_SetPrinterInfo($hPrinter, $iProp, $iValue, $bGlobal) If Not $hPrinter Or Not BitAND($iProp, $PRINTER_AUTHORIZED_PROPERTIES) Or Not IsBool($bGlobal) Then Return SetError(1) and eliminated (for test purposes) the testing of the $iValue and used _PRNT_SetPrinterInfo($hPrinter, $DM_DUPLEX, "Installed", True) but also with no positive result.
-
What does this UDF tell me? The output is a table with 2 columns, ROW and Col0 including some values. I assume, this shows the raw data what capabilities the printer has. But question is how to translate the figures and how to set the duplex function. I guess, I am not sure, there is nothing in the script on that!?
-
I have an HP Laserjet printer with duplex. Always after updating windows, the duplex function is disabled. Now I am looking for a autoit-script to set the duplex function what I could run every day at boot. I would like to have some help how to do this! I did not do any autoit on HW! Thanks for hints!
-
Hi, how can I send the pipe character "|". I have tried on GERMAN Keyboard: {CTRLDOWN}{ALTDOWN}{<}{CTRLUP}{ALTUP} but did not work. As far as I know, there seems to be no ASC-Code for this.