Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Track mouse click from PowerShell

Posted on 2010-08-24
3
Medium Priority
?
2,717 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:Meir Rivkin
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:
Meir Rivkin earned 2000 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

Technology Partners: 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 brief introduction to what I consider to be the best editor for PowerShell.
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
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…
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 anti-spam), the admin…

916 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