Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9196587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:52:58+00:00 2026-06-17T21:52:58+00:00

For a Windows 7 app, I want to write a simple script which can

  • 0

For a Windows 7 app, I want to write a simple script which can log the current position of the timestamp, the mouse cursor and the window name in a csv log file. I want it to log in the background for usability testing of my program, only when the user clicks the mouse. The format is csv:

timestamp, mouse_btn_name mouse_xpos,mouse_ypos, title_window_handler

I found an example here, but now a complete one as per my requirements. How do I do the logging?

MouseGetPos, xpos, ypos 
Msgbox, The cursor is at X%xpos% Y%ypos%. 

; This example allows you to move the mouse around to see
; the title of the window currently under the cursor:
#Persistent
SetTimer, WatchCursor, 100
return

WatchCursor:
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
ToolTip, ahk_id %id%`nahk_class %class%`n%title%`nControl: %control%
return
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T21:53:00+00:00Added an answer on June 17, 2026 at 9:53 pm

    Your example logs every 100 ms which creates a very long list.
    If you only want to log when mouse buttons are clicked, use something like this:

    ~LButton::
    MyButton = Left
    GoSub, MyRecord
    Return
    
    ~RButton::
    MyButton = Right
    GoSub, MyRecord
    Return
    
    MyRecord:
    MouseGetPos, xpos, ypos 
    WinGetTitle, title, A
    FormatTime, CurrentDateTime,, yyyy-MM-dd-HH-mm-ss 
    FileAppend, %CurrentDateTime%`,%xpos%`,%ypos%`,%MyButton%`,%title%`n, C:\Temp\Record.csv
    Return
    

    Let me know if this suits.
    Edits: Changed to csv and separately record left and right mouse actions

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Want to write a typing test application (GUI, windows). Is simple terms. app shows
I want to write a media management Metro app for windows 8 and I
I want to deveplop an app for Windows Mobile 5.0 and above that can
I want to write unit tests for an app running on Windows CE .NET
I want to write a simple c++/c console app, to show my process 1%
I want to write a windows service that will communicate with my win app
I want to write Html format, but I can not even get a simple
In a Windows 8 Metro App I want the ListViewItems/Tiles to open a link
I want my windows phone app to communicate with a desktop app (in Windows),
I am working on a Windows Phone 7 app and I want to give

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.