Jump to content

My translation from Vbs


Recommended Posts

I was trying to convert this Vbs script to autoit .

and gettng error on " select part " can one tell my mistake

$strComputer = "." 
 $objWMIService = ObjGet("winmgmts:\\" & $strComputer & "\root\WMI") 
 
 $colItems = $objWMIService.ExecQuery( _
    "SELECT * FROM MSMouse_PortInformation",,48) 

; vbs script for error line translated as above 
;--------------------------------------------
;Set colItems = objWMIService.ExecQuery( _
;    "SELECT * FROM MSMouse_PortInformation",,48) 
;~---------------------------------

For $objItem in $colItems 
    
    
    MsgBox(4096,"Active " , $objItem.Active)
    MsgBox(4096,"ConnectorType " , $objItem.ConnectorType)
    MsgBox(4096,"Buttons " , $objItem.Buttons)
    
    

Next
Link to comment
Share on other sites

This works for me:

$objWMIService = ObjGet("winmgmts:\\" & @ComputerName & "\root\WMI")

$colItems = $objWMIService.ExecQuery ("SELECT * FROM MSMouse_PortInformation")

$n = 1
For $objItem In $colItems
    MsgBox(4096, "Mouse: " & $n, "Active: " & $objItem.Active & @CRLF & _
            "ConnectorType: " & $objItem.ConnectorType & @CRLF & _
            "Buttons: " & $objItem.Buttons)
    $n += 1
Next

:shocked:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...