Solved

Track mouse click from PowerShell

Posted on 2010-08-24
3
2,487 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

752 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