Jump to content

Problem with right click script to bring up menu


 Share

Recommended Posts

I can't figure out why this doesn't work.  Here is what I am trying to do: When u run a scan(click run cleaner button) in ccleaner you can right click on the results window which brings up a context menu where you select save as text file. I am trying to automate the right click with the following script:

#include <GuiListView.au3>
Local $hList = ControlGetHandle("[CLASS:PiriformCCleaner]", "", "[CLASS:Edit; INSTANCE:2]")

Local $aClient = WinGetPos($hList)
Local $aPos = _GUICtrlListView_GetItemPosition($hList, _GUICtrlListView_GetSelectedIndices($hList))

MouseClick("Right", $aClient[0] + $aPos[0] + 40, $aClient[1] + $aPos[1] +40)

I notice if I have another window on top of ccleaner like notepad++ and run the script I get the context menu for notepad

Link to comment
Share on other sites

Fixed it

#requireadmin
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#include <GuiListView.au3>
;~  Shellexecute("\Cleaner\apps\CCleaner\CCleaner.exe")
;~      sleep(2000)
       WinActivate("Piriform CCleaner", "&Run Cleaner")
     WinWaitActive("Piriform CCleaner", "&Run Cleaner")
;~     ControlClick("Piriform CCleaner", "&Run Cleaner", "[CLASS:Button; INSTANCE:2]")

;Local $hList = ControlGetHandle("[CLASS:ATL:00000001405248F0]", "", "[CLASS:Edit; INSTANCE:1]")
Local $hList = ControlGetHandle("[CLASS:PiriformCCleaner]", "", "[CLASS:Edit; INSTANCE:2]")

Local $aClient = WinGetPos($hList)
Local $aPos = _GUICtrlListView_GetItemPosition($hList, _GUICtrlListView_GetSelectedIndices($hList))
$x = MouseClick("Right", $aClient[0] + $aPos[0] +170, $aClient[1] + $aPos[1] +230, 1, 40)

;msgbox(0, "", "x is: " & $x)
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...