Solved

Track mouse click from PowerShell

Posted on 2010-08-24
3
2,268 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article will help you understand what HashTables are and how to use them in PowerShell.
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now