Logging 鼠标位置记录器
对于Windows7应用程序,我想编写一个简单的脚本,它可以在csv日志文件中记录时间戳的当前位置、鼠标光标和窗口名称。我想让它在后台登录,以便对我的程序进行可用性测试,仅当用户单击鼠标时。格式为csv:Logging 鼠标位置记录器,logging,macros,ui-automation,autohotkey,Logging,Macros,Ui Automation,Autohotkey,对于Windows7应用程序,我想编写一个简单的脚本,它可以在csv日志文件中记录时间戳的当前位置、鼠标光标和窗口名称。我想让它在后台登录,以便对我的程序进行可用性测试,仅当用户单击鼠标时。格式为csv: timestamp, mouse_btn_name mouse_xpos,mouse_ypos, title_window_handler 我找到了一个,但现在根据我的要求找到了一个完整的。我怎么做日志记录 MouseGetPos, xpos, ypos Msgbox, The curso
timestamp, mouse_btn_name mouse_xpos,mouse_ypos, title_window_handler
我找到了一个,但现在根据我的要求找到了一个完整的。我怎么做日志记录
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
您的示例每100毫秒记录一次日志,这将创建一个很长的列表。
如果您只想在单击鼠标按钮时登录,请使用以下方法:
~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
让我知道这是否合适。编辑:更改为
csv
,并分别记录鼠标左键和右键动作您的示例日志每100毫秒记录一次,这将创建一个很长的列表。如果您只想在单击鼠标按钮时登录,请使用以下方法:
~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
让我知道这是否合适。编辑:更改为
csv
,并分别记录鼠标左键和右键动作为什么不使用~LButton和不干扰鼠标单击。为什么不使用~LButton和不干扰鼠标单击。请提供建议解决方案的一些反馈,如果答案有帮助,请“接受”该答案。非常感谢。请就建议的解决方案提供一些反馈,如果答案有帮助,请“接受”该答案。非常感谢。