title: How to right click on a file present in a directory using AutoIT?
body: <p>I am trying to simulate the functionality of automating right click of a mouse on a specific file or a folder in windows explorer and this is the code snippet I have written to simulate that :</p>
  
  <pre><code>#include&lt;GUIListView.au3&gt;
  
  Local $filepath = "C:\Windows\addins"
  
  Local $iPid = Run("explorer.exe /n,/e,/select," &amp; $filepath)
  ProcessWait($iPid)
  
  Sleep(1000)
  
  Local $hList = ControlGetHandle("[CLASS:CabinetWClass]", "", "[CLASS:SysListView32; INSTANCE:1]")
  
  Local $aClient = WinGetPos($hList)
  Local $aPos = _GUICtrlListView_GetItemPosition($hList, _GUICtrlListView_GetSelectedIndices($hList))
  
  MouseClick("Right", $aClient[0] + $aPos[0] + 4, $aClient[1] + $aPos[1] + 4)
  </code></pre>
  
  <p>but this returns me an error saying this : </p>
  
  <blockquote>
    <blockquote>
      <p>"C:\Program Files (x86)\AutoIt3\SciTE..\autoit3.exe" /ErrorStdOut "C:\Users\asablok\Desktop\My Documents\Calculator.au3"<br>
      "C:\Users\asablok\Desktop\My Documents\Calculator.au3" (15) : ==>
      Subscript used on non-accessible variable.: MouseClick("Right",
      $aClient[0] + $aPos[0] + 4, $aClient[1] + $aPos[1] + 4)
      MouseClick("Right", $aClient^ ERROR
      Exit code: 1    Time: 1.593</p>
    </blockquote>
  </blockquote>
  
  <p>Can anyone suggest me a workaround as to how to address this problem of simulating right clicking using AutoIT.</p>