Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Logging 鼠标位置记录器_Logging_Macros_Ui Automation_Autohotkey - Fatal编程技术网

Logging 鼠标位置记录器

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

对于Windows7应用程序,我想编写一个简单的脚本,它可以在csv日志文件中记录时间戳的当前位置、鼠标光标和窗口名称。我想让它在后台登录,以便对我的程序进行可用性测试,仅当用户单击鼠标时。格式为csv:

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和不干扰鼠标单击。请提供建议解决方案的一些反馈,如果答案有帮助,请“接受”该答案。非常感谢。请就建议的解决方案提供一些反馈,如果答案有帮助,请“接受”该答案。非常感谢。