Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/20/2021 in all areas

  1. jguinch

    Printers Management UDF

    Hello. I did create these few functions several months ago. I post here, if it can interest someone. These functions based on WMI queries allow you to manage printers : add / delete printer, driver, port, or obtain configuration, set default printer ... I let you discover it with the code. Here is the list of the available functions : _PrintMgr_AddLocalPort _PrintMgr_AddLPRPort _PrintMgr_AddPrinter _PrintMgr_AddPrinterDriver _PrintMgr_AddTCPIPPrinterPort _PrintMgr_AddWindowsPrinterConnection _PrintMgr_CancelAllJobs _PrintMgr_CancelPrintJob _PrintMgr_EnumPorts _PrintMgr_EnumPrinter _PrintMgr_EnumPrinterConfiguration _PrintMgr_EnumPrinterDriver _PrintMgr_EnumPrinterProperties _PrintMgr_EnumPrintJobs _PrintMgr_EnumTCPIPPrinterPort _PrintMgr_Pause _PrintMgr_PortExists _PrintMgr_PrinterExists _PrintMgr_PrinterSetComment _PrintMgr_PrinterSetDriver _PrintMgr_PrinterSetPort _PrintMgr_PrinterShare _PrintMgr_PrintTestPage _PrintMgr_RemoveLocalPort _PrintMgr_RemoveLPRPort _PrintMgr_RemovePrinter _PrintMgr_RemovePrinterDriver _PrintMgr_RemoveTCPIPPrinterPort _PrintMgr_RenamePrinter _PrintMgr_Resume _PrintMgr_SetDefaultPrinter And some examples : #include <Array.au3> #include "PrintMgr.au3" _Example() Func _Example() ; Remove a printer called "My old Lexmark printer" : _PrintMgr_RemovePrinter("My old Lexmark printer") ; Remove the driver called "Lexmark T640" : _PrintMgr_RemovePrinterDriver("Lexmark T640") ; Remove the TCP/IP printer port called "TCP/IP" _PrintMgr_RemoveTCPIPPrinterPort("MyOLDPrinterPort") ; Add a driver, called "Samsung ML-451x 501x Series", and driver inf file is ".\Samsung5010\sse2m.inf" _PrintMgr_AddPrinterDriver("Samsung ML-451x 501x Series", "Windows NT x86", @ScriptDir & "\Samsung5010", @ScriptDir & "\Samsung5010\sse2m.inf") ; Add a TCP/IP printer port, called "MyTCPIPPrinterPort", with IPAddress = 192.168.1.10 and Port = 9100 _PrintMgr_AddTCPIPPrinterPort("MyTCPIPPrinterPort", "192.168.1.10", 9100) ; Add a printer, give it the name "My Printer", use the driver called "Samsung ML-451x 501x Series" and the port called "MyTCPIPPrinterPort" _PrintMgr_AddPrinter("My Printer", "Samsung ML-451x 501x Series", "MyTCPIPPrinterPort") ; Set the printer called "My Printer" as default printer _PrintMgr_SetDefaultPrinter("My Printer") ; Connect to the shared printer "\\192.168.1.1\HPDeskjetColor") _PrintMgr_AddWindowsPrinterConnection("\\192.168.1.1\HPDeskjetColor") ; List all installed printers Local $aPrinterList = _PrintMgr_EnumPrinter() _ArrayDisplay($aPrinterList) ; List all printers configuration Local $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration() _ArrayDisplay($aPrinterConfig) ; List all installed printer drivers Local $aDriverList = _PrintMgr_EnumPrinterDriver() _ArrayDisplay($aDriverList) ; Retrieve the printer configuration for the printer called "Lexmark T640" $aPrinterConfig = _PrintMgr_EnumPrinterConfiguration("Lexmark T640") _ArrayDisplay($aPrinterConfig) ; Add a local printer port (for a file output) _PrintMgr_AddLocalPort("c:\temp\output.pcl") ; Remove the local port _PrintMgr_RemoveLocalPort("c:\temp\output.pcl") ; Enum a print job Local $aJobList = _PrintMgr_EnumPrintJobs() _ArrayDisplay($aJobList) EndFunc ;==>_Example Download link : PrintMgr_Example.au3 PrintMgr.au3
    1 point
  2. jguinch

    Printers Management UDF

    I'm happy to say that there are two new functions : _PrintMgr_EnumPrintJobs and _PrintMgr_CancelPrintJob @skavenger, with these two functions, you will be able to do want you need.
    1 point
  3. No production versions ...but:
    1 point
  4. It's possible that the quotation marks are causing the issue. Have you tried removing them from the 3rd line? P.S. You don't need these lines in your function as the contents have already been read into an array -- $hConfigOpen = FileOpen($sConfigPath, $FO_READ) If $hConfigOpen = -1 Then Exit MsgBox($MB_SYSTEMMODAL, "", "error reading Config.txt.");If open error
    1 point
  5. ... and I want people to refrain from joining and posting this shit in a forum that has nothing to do with it !
    1 point
  6. I want to get the next car that has two fuel tanks, each with a pump. I want to be able to switch between two fuels. The car should ideally be from the 90s or older. Diesel or gasoline engine. The reason for this is that I want to drive with better fuel, but with it the car does not start very well on a cold start. "The AEX motor only runs when it is already warm. It does not run on a cold start. Only after 30 attempts to start did more and more explosions occur. When it starts, you still have to hold it with the accelerator, otherwise the speeds would be lubricated and." he goes out then. " Have already tried to drive on the fuel. "That's why I need an extra tank of gasoline to warm up the engine. Two problems: An additional tank must be registered with the TÜV. That's why I can only use the additional tank to warm up. If I want to drive, I have to remove it again. (It is legal to use the windshield washer fluid tank as a fuel tank) So I need something where I can plug in the tank to start up and then remove it again afterwards. Unfortunately, it is illegal to warm up the engine on public ground. I also don't know how to drive with the fuel from the additional tank, so you have to somehow connect that to the gas pedal and then you need a gasoline pump. " It's too cumbersome to legally incorporate something like this. That's why I need something that already has it.
    0 points
  7. okay sorry, i was looking for a car forum, not IT.
    0 points
×
×
  • Create New...