c.haslam Posted May 31, 2018 Posted May 31, 2018 (edited) How can I find the IPv4 address of a printer from its name, e.g. Lexmark CS310 ? To be more precise: the printer shows in Devices and Printers as Lexmark CS310 updated. This is the only Lexmark on my LAN, so finding the IP for Lexmark would be OK for me. I am trying to overcome the problem where the IP address of the printer changes, with a short script. I have searched the forum. I found lots on networking, but nothing for this specific problem. Edited May 31, 2018 by c.haslam Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
jguinch Posted May 31, 2018 Posted May 31, 2018 Using Printer Management UDF : #include "PrintMgr.au3" Local $aPrinterProperties = _PrintMgr_EnumPrinterProperties("Lexmark CS310") If Not UBound($aPrinterProperties) Then Exit MsgBox(16, "Error", "Printer not found") Local $sPortName = $aPrinterProperties[0][60] Local $aTCPIPPorts = _PrintMgr_EnumTCPIPPrinterPort(), $sIP For $i = 0 To UBound($aTCPIPPorts) - 1 If $sPortName = $aTCPIPPorts[$i][0] Then $sIP = $aTCPIPPorts[$i][1] Next ConsoleWrite( ($sIP ? "IP address of the printer : " & $sIP : "Unable to find the printer IP address") ) Gianni 1 Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF
c.haslam Posted May 31, 2018 Author Posted May 31, 2018 Thank you Spoiler CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now