iceberg Posted May 18, 2005 Share Posted May 18, 2005 Hi, Is there any way to check in the registry if a PC has a USB001 Printer Port? Thanks. mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
DaveF Posted May 18, 2005 Share Posted May 18, 2005 Is there any way to check in the registry if a PC has a USB001 Printer Port? Step over the subkeys of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers in the registry and check the Port value under each:Dim $subKeys, $subKeyName, $portName While 1 $subKeys = $subKeys + 1 $subKeyName = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers", $subKeys) If @error = -1 Then ExitLoop $portName = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\" & $subKeyName, "Port") MsgBox(0, "Debug", $portName) WEnd Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
iceberg Posted May 18, 2005 Author Share Posted May 18, 2005 (edited) thanks DaveF. is there any way to do something like this: if PC has USB001 port then do something else endif thanks. Edited May 18, 2005 by iceberg mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
DaveF Posted May 18, 2005 Share Posted May 18, 2005 Dim $subKeys, $subKeyName, $portName While 1 $subKeys = $subKeys + 1 $subKeyName = RegEnumKey("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers", $subKeys) If @error = -1 Then ExitLoop $portName = RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Printers\" & $subKeyName, "Port") If StringInStr($portName, "USB001") Then SmiteAll() Else Whimper() EndIf WEnd Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines. Link to comment Share on other sites More sharing options...
SvenP Posted May 18, 2005 Share Posted May 18, 2005 Hi,Is there any way to check in the registry if a PC has a USB001 Printer Port?Thanks.<{POST_SNAPBACK}>if FileExists("USB001:") then Msgbox(0,"Found!","USB port found.") else Msgbox(0,"Not Found","USB port NOT found.") endifAt least this code works with LPT/COM-ports, you could try if it would also works for USB-ports.Regards,-Sven Link to comment Share on other sites More sharing options...
iceberg Posted May 19, 2005 Author Share Posted May 19, 2005 DaveF your codes work fine. SvenP the codes do not recognise USB printer ports. thanks alot guys! mouse not found....scroll any mouse to continue. Link to comment Share on other sites More sharing options...
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