Solved

Track mouse click from PowerShell

Posted on 2010-08-24
3
2,412 Views
Last Modified: 2012-05-10
Hello,

I am able to track mouse X and Y coords within PowerShell by using the [System.Windows.Forms.Cursor]::Position assembely.  This can track X and Y coords outside of the PowerShell session.

Is there anyway to track the mouse click event, regardless of what is being clicked?  Ultimately I am looking to track X & Y at time of mouse click anywhere in the OS.

Thank you for any info.
0
Comment
Question by:omnipower321
  • 2
3 Comments
 
LVL 42

Expert Comment

by:sedgwick
ID: 33557001
kinda tricky but finally i found a tweak, what you do is using VBCodeProvider to run vb.net code which perform the low-level mouse hooking.

check this post as an example of low-level keyboard hooking via powershell:
http://waynes-world-it.blogspot.com/2008/06/powershell-low-level-keyboard-hook.html



0
 
LVL 42

Accepted Solution

by:
sedgwick earned 500 total points
ID: 33557007
check this mouse/keyboard hook code in vb.net which you can integrate into your powershell script
http://www.colinneller.com/blog/PermaLink,guid,2838f59a-f4af-4c95-a322-b9ee5918a39c.aspx
0
 

Author Closing Comment

by:omnipower321
ID: 33560252
Yikes, I think this is a bit out of my league, but I will attempt to decipher.  Thanks!
0

Featured Post

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Synchronize a new Active Directory domain with an existing Office 365 tenant
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question