Jump to content

How to automate rightclick and select menu item on one of the list view item?


Recommended Posts

I want to automate right click operation on one of the items of listview control and select a menu item.

In particular, I have opened printer & faxes and I want to right click on one printer driver and select properties of that printer driver.

Does any one know how to do last part? ie selecting a menu item?

Thanks in advance

Kanit

Link to comment
Share on other sites

There's a few ways to do it. You can emulate mouse clicks/keystrokes, or you can script it using a shell object.

$shell = ObjCreate("Shell.Application")
$folder = $shell.NameSpace(4)

For $objItem in $folder.Items
    For $verb in $objItem.verbs
        If $verb.Name = "P&roperties" Then
            $ans = msgbox(4,"Configure Printer" ,"Open Properties for " & @CRLF & $objItem.Name)
            If $ans = 6 Then 
                $verb.DoIt
                WinWait($objItem.name)
                While WinExists($objItem.name)
                Wend
            EndIF
        EndIf
    Next
Next
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...