Sign in to follow this  
Followers 0
ScriptUSER

My translation from Vbs

3 posts in this topic

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

Share this post


Link to post
Share on other sites

Not totally sure what the return should be but if you take off the ,,48 it will run with no errors.


Share this post


Link to post
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

Share this post


Link to post
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
Sign in to follow this  
Followers 0