Guidance
指路人
g.yi.org
Software / Reginald / Examples / repository / Printing / Ports / Avail.rex

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
/* Identifies all the TCP/IP printer ports on a computer, and indicates which ports are being used and which ports are available */
objdictionary = createcomobject("Scripting.Dictionary")

strcomputer = "."
objwmiservice = getobject("winmgmts:{impersonationLevel=impersonate}!\\" || strcomputer || "\root\cimv2")

colprinters =  objwmiservice~execquery("Select * from Win32_Printer")

DO objprinter OVER colprinters 
    objdictionary~add(objprinter~portname, objprinter~portname)
END

strusedports = ""
strfreeports = ""
colports = objwmiservice~execquery("Select * from Win32_TCPIPPrinterPort")
DO objport OVER colports
    IF objdictionary~exists(objport.name) = 1 THEN
        strusedports = strusedports objdictionary~item(objport.name)
    ELSE
        strfreeports = strfreeports objport~name
END

SAY "The following ports are in use:" strusedports
SAY "The following ports are available:" strfreeports

掌柜推荐
 
 
¥1,420.00 ·
 
 
¥950.00 ·
 
 
¥288.00 ·
 
 
¥738.00 ·
 
 
¥397.00 ·
 
 
¥750.00 ·
© Sun 2024-11-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2010-07-16 20:49:16