title: How to Drag & Drop with Powershell ps1 script?
body: <p>I have a simple program that has drag &amp; drop functionality.</p>
  
  <p>I want to drag from pixel point (x1,y1) to pixel point (x2,y2) and release the mouse.</p>
  
  <p>How can I automate this with Powershell?
  Following this <a href="https://blogs.technet.microsoft.com/heyscriptingguy/2011/01/10/provide-input-to-applications-with-powershell/" rel="nofollow noreferrer">basic tutorial</a>, I can open the program and sendkeys.. but how to drag/drop?</p>
  
  <pre><code>add-type -AssemblyName microsoft.VisualBasic
  add-type -AssemblyName System.Windows.Forms
  
  Notepad
  
  start-sleep -Milliseconds 500
  
  #[Microsoft.VisualBasic.Interaction]::AppActivate("GUI_APP_I_USE")
  [Microsoft.VisualBasic.Interaction]::AppActivate("Notepad")
  
  [System.Windows.Forms.SendKeys]::SendWait("Hello")
  #[Some.Library.I.Drag.Drop.With]::DragStart(x1,y1)
  #[Some.Library.I.Drag.Drop.With]::DragEnd(x2,y2)
  </code></pre>