Leaderboard
Popular Content
Showing content with the highest reputation on 09/25/2019 in all areas
-
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.au31 point
-
printing using UDF and a dll
abberration reacted to martin for a topic
This is a printing UDF which allows you to print text in any font, size and colour at any position on the page, draw lines, curves, elipses, pies in any colour, and print images. Useful for labels, reports, graphs and standard forms. Can also print barcodes. It uses my printmg.dll. It is not intended to do the sorts of thing you can do with the Word UDF by big_daddy. Note the dll is 32 bit and so only works with 32 bit applications. printout from the code in the example in the download. Functions available are - Start using/Finish using the UDF _PrintDllStart _PrintDllClose _PrintVersion - Returns version of UDF or dll _PrintSetTitle Printer control _PrintStartPrint _PrintAbort _PrintEndPrint _PrintNewPage Printer selection, getting & setting parameters _PrintListPrinters - lists all installed printers _PrintSetPrinter - manual printer selection dialogue _PrintSelectPrinter - programmatically set the printer. _PrintGetPageWidth _PrintGetPaperWidth _PrintGetPageHeight _PrintGetPaperHeight _PrintGetHorRes _PrintGetVertRes _PrintGetXOffset _PrintGetYOffset _PrintPageOrientation - set portrait or landsacpe Text printing _PrintSetFont - Font, size, attributes and colour _PrintText - At x,y and angle. _PrintGetextWidth _PrintGetTextHeight Graphics _PrintSetLineCol _PrintSetLIneWid _PrintSetBrushCol - sets the colour used for filling _PrintLine _PrintEllipse - Filled ellipse or circle _PrintPie - for filled pie slice _PrintArc - Elliptical or circular arcs _PrintRectangle - filled rectangle _PrintRoundedRectangle _PrintImage - prints jpg, bmp and ico files (Has problems with some icons bigger than 64 x 64) _PrintImageFromDC Latest change = 25th February 2011 Added example to the download which was missing. Get the UDF, dll and example from here. ================================================================= See also these udf's for printing from AutoIt using the Windows API and not using a dll. by GRS - http://www.autoitscript.com/forum/topic/...m-autoit/page__view__findpost_ by Prog@ndy -http://www.autoitscript.com/forum/topic/...gdi-udfs/page__view__findpost_ and this one which embeds a dll in the script for creating pdf files. printing to a pdf by taietel see1 point -
Different actions depending on the language
Musashi reacted to Earthshine for a topic
give me download link to the installer, i will have a look you should be able to type setup /? and get a form that pops up showing the switches, if it's an MSI it's not an msi, it's a self extracting exe is all, from what i could find on internet.1 point -
Maybe something like this would work? Not tested, and may need to be adjusted to fit your needs. For $i = 0 To UBound($sPC) - 1 Local $sVersion2 = "0.0.0", $sVersion = FileGetVersion('\\' & $sPC[$i] & '\C$\Program Files\Trend Micro\OfficeScan Client\Ntrtscan.exe', "FileVersion") ; check programfiles for the file version If @error Then ; first one not found $sVersion2 = FileGetVersion('\\' & $sPC[$i] & '\C$\Program Files (x86)\Trend Micro\OfficeScan Client\Ntrtscan.exe', "FileVersion") ; Check programfiles (x86) for the file If @error Then ; still not found _ArrayAdd($Array, $sPC[$i] & "," & "Offline or No Trend") ; add to the array that it doesn't exist in either location ContinueLoop EndIf EndIf _ArrayAdd($Array, $sPC[$i] & "," & $sVersion & " : " & $sVersion2) ; add the version information for the found version Next NOTE: I have edited the original script. The original script wouldn't have written the correct version number into the array if it had been found in the first test, and would have errored due to the variable $sVersion 2 being declared inside the second If conditional check. This declares that variable before the first test, and shouldn't have the problem.1 point
-
Different actions depending on the language
Earthshine reacted to Musashi for a topic
1. Are you sure, that the WinWait parameters are correct ? 2. I think, there should be an ExitLoop in the If statements If WinExists(...) Then (...) ExitLoop EndIf1 point -
Update : Version 1.0.0.1 Optimized whole code, added redim step var. Hi, I had to create Excel files for my needs, but I wondered how to do it because xlsx files are not raw editable; so I searched for a way do it. Excel can open multiple files type, and the XML is a good way to do it so here it is. It creates an Excel XML file, with which you will be able to : -Create Rows -Create Cells and set it's color -Set column width -Set global text horizontal align -Set XML author -Set XML creation date -Set XML compagny And of course you can easily add features. Here is an example : #include "Excel_XML.au3" $iRow = _ExcelXML_Row_Add() _ExcelXML_Column_SetWidth(1, 100) _ExcelXML_Cell_Add($iRow, "Row 1, Cell 1") _ExcelXML_Column_SetWidth(2, 200) _ExcelXML_Cell_Add($iRow, "Column width set to 200px") $iRow = _ExcelXML_Row_Add() $iCell = _ExcelXML_Cell_Add($iRow, "Cell color red") _ExcelXML_Cell_SetColor($iCell, 0xFF0000) _ExcelXML_Cell_Add($iRow, "Excel XML UDF") $hFile = FileOpen(@ScriptDir & "\Excel_XML test.xml", 2) FileWrite($hFile, _ExcelXML_Assemble()) FileClose($hFile) _ExcelXML_Destroy() And what you are waiting for : Excel_XML.au3 (Previous : 53 downloads) Enjoy !1 point