• 按键公众号 :
按键精灵电脑版
立即下载

软件版本:2014.06
软件大小:22.9M
更新时间:2021-12-03

按键精灵安卓版
立即下载

软件版本:3.7.2
软件大小:46.2M
更新时间:2023-05-10

按键精灵iOS版
立即下载

软件版本:1.8.0
软件大小:29.2M
更新时间:2023-03-21

按键手机助手
立即下载

软件版本:3.8.0
软件大小:262M
更新时间:2023-05-30

快捷导航

登录 后使用快捷导航
没有帐号? 注册

发新话题 回复该主题

[笨蛋熊] 【按键X】开箱即用的支持前台和后台的双模式脚本录制工具,附送... [复制链接]

1#
先看效果图:






这是通过本工具录制的后台脚本:



录制出来的完整脚本:
  1. // 窗口句柄:2036628 (1381388)
  2. // 窗口标题:语言标准.txt [C:\Users\Administrator\Desktop] - Notepad3 (管理员权限)
  3. // 窗口类名:Notepad3U



  4. // 后台配置
  5. Dim DisplayMode = "dx"
  6. Dim MouseMode = "windows"
  7. Dim KeyboardMode = "windows"



  8. // 初始化
  9. Import "dm.dll"
  10. dm.BindWindow(2036628, DisplayMode, MouseMode, KeyboardMode, 0)



  11. // 录制的脚本
  12. Delay(1328)
  13. Delay(110)
  14. dm.MoveTo(349, 227)
  15. dm.LeftUp()
  16. Delay(468)
  17. dm.MoveTo(411, 616)
  18. dm.LeftDown()
  19. Delay(78)
  20. dm.MoveTo(411, 616)
  21. dm.LeftUp()
  22. Delay(860)
  23. dm.MoveTo(952, 92)
  24. dm.LeftDown()
  25. Delay(640)
  26. dm.MoveTo(955, 284)
  27. dm.LeftUp()
  28. Delay(454)
  29. dm.MoveTo(255, 290)
  30. dm.LeftDown()
  31. Delay(93)
  32. dm.MoveTo(255, 290)
  33. dm.LeftUp()
  34. Delay(172)
  35. dm.MoveTo(206, 321)
  36. dm.LeftDown()
  37. Delay(110)
  38. dm.MoveTo(206, 321)
  39. dm.LeftUp()
  40. Delay(578)
  41. dm.KeyDown(49)
  42. Delay(125)
  43. dm.KeyDown(50)
  44. Delay(15)
  45. dm.KeyUp(49)
  46. Delay(125)
  47. dm.KeyDown(51)
  48. Delay(32)
  49. dm.KeyUp(50)
  50. Delay(62)
  51. dm.KeyUp(51)
  52. Delay(609)
  53. dm.KeyDown(8)
  54. Delay(63)
  55. dm.KeyUp(8)
  56. Delay(109)
  57. dm.KeyDown(8)
  58. Delay(47)
  59. dm.KeyUp(8)
  60. Delay(94)
  61. dm.KeyDown(8)
  62. Delay(47)
  63. dm.KeyUp(8)
  64. Delay(156)
  65. dm.MoveTo(236, 308)
  66. dm.LeftDown()
  67. Delay(94)
  68. dm.MoveTo(236, 308)
  69. dm.LeftUp()
  70. Delay(1031)
  71. Delay(63)
  72. Delay(703)
  73. Delay(218)
复制代码
源代码下载:

record.zip (, 下载次数:279)




生成好的小精灵下载:
recordexe.zip (, 下载次数:351)




我会在2L跟帖,来讲一下这个工具的源代码,请稍候。

最后编辑笨蛋熊 最后编辑于 2022-05-09 12:36:20
2#

星月扩展库发布贴(这个工程使用xyapi插件实现):http://bbs.anjian.com/showtopic-664233-1.aspx

键鼠录制的核心功能由 xyapi 的这四个函数实现:
  1. // HOOK库
  2. Declare Sub Hook_InsKey_LowLevel Lib "xyapi.dll" (ByVal EventProc As Long)
  3. Declare Sub Hook_DelKey_LowLevel Lib "xyapi.dll" ()
  4. Declare Sub Hook_InsMouse_LowLevel Lib "xyapi.dll" (ByVal EventProc As Long)
  5. Declare Sub Hook_DelMouse_LowLevel Lib "xyapi.dll" ()
复制代码
这四个函数可以挂钩低级键鼠HOOK,从而在键盘和鼠标做动作的时候,将这些动作记录下来。

安装HOOK的时候有一个参数,是用来接收事件的标签控件句柄,这个用法和原理可以参考这个帖子:http://bbs.anjian.com/showtopic-699851-1.aspx



之后我们处理两个事件,把获得的键盘和鼠标动作记录下来,就形成了我们需要的功能。
  1. // 键盘HOOK事件
  2. Event Form1.KHook.Click
  3.     // 处理参数
  4.     Dim Param = Split(Form1.KHook.Caption, "|")
  5.     Dim iCode = CLng(Param(1))
  6.     Dim wParam = CLng(Param(2))
  7.     Dim wVk = CLng(Param(3))
  8.     Dim wScan = CLng(Param(4))
  9.     Dim dwFlags = CLng(Param(5))
  10.     Dim Time = CLng(Param(6))
  11.     Dim dwExtraInfo = CLng(Param(7))
  12.     // 录制逻辑
  13.     If iCode = 0 Then
  14.         Dim NewTime = GetTickCount()
  15.         RecordScript = RecordScript & "Delay(" & (NewTime - OldTime) & ")\r\n"
  16.         OldTime = NewTime
  17.         Select Case wParam
  18.             Case 260, 256    // WM_SYSKEYDOWN, WM_KEYDOWN
  19.                 If WindowMode Then    // 后台
  20.                     If GetForegroundWindow() = RecordWindow Then
  21.                         RecordScript = RecordScript & "dm.KeyDown(" & wVk & ")\r\n"
  22.                     End If
  23.                 Else                // 前台
  24.                     RecordScript = RecordScript & "KeyDown(" & wVk & ")\r\n"
  25.                 End If
  26.             Case 261, 257    // WM_SYSKEYUP, WM_KEYUP
  27.                 If WindowMode Then    // 后台
  28.                     If GetForegroundWindow() = RecordWindow Then
  29.                         RecordScript = RecordScript & "dm.KeyUp(" & wVk & ")\r\n"
  30.                     End If
  31.                 Else                // 前台
  32.                     RecordScript = RecordScript & "KeyUp(" & wVk & ")\r\n"
  33.                 End If
  34.         End Select
  35.     End If
  36. End Event

  37. // 鼠标HOOK事件
  38. Event Form1.MHook.Click
  39.     // 处理参数
  40.     Dim Param = Split(Form1.MHook.Caption, "|")
  41.     Dim iCode = CLng(Param(1))
  42.     Dim wParam = CLng(Param(2))
  43.     Dim dx = CLng(Param(3))
  44.     Dim dy = CLng(Param(4))
  45.     Dim mouseData = CLng(Param(5)) \ 120
  46.     Dim dwFlags = CLng(Param(6))
  47.     Dim Time = CLng(Param(7))
  48.     Dim RetXY = Window_ConvS2C(RecordWindow, dx, dy)
  49.     // 录制逻辑
  50.     If iCode = 0 Then
  51.         Dim NewTime = GetTickCount()
  52.         Dim KeyTbl = {513:"MouseDown(0)", 514:"MouseUp(0)", 516:"MouseDown(1)", 517:"MouseUp(1)", 519:"MouseDown(2)", 520:"MouseUp(2)"}
  53.         Dim KeyTblDM = {513:"dm.LeftDown()", 514:"dm.LeftUp()", 516:"dm.RightDown()", 517:"dm.RightUp()", 520:"dm.MiddleClick()"}
  54.         Select Case wParam
  55.             Case 512    // WM_MOUSEMOVE
  56.                 If StepMove Then    // 仅在开启 记录完整的鼠标移动轨迹 时录制
  57.                     If NewTime <> OldTime Then    // 仅在时间变化时记录轨迹 [为了降低代码量]
  58.                         RecordScript = RecordScript & "Delay(" & (NewTime - OldTime) & ")\r\n"
  59.                         OldTime = NewTime
  60.                         If WindowMode Then    // 后台 [只在窗口激活并且鼠标在窗口范围内才记录]
  61.                             If GetForegroundWindow() = RecordWindow Then
  62.                                 If Window_GetRoot(Window_FormMouse()) = RecordWindow Then
  63.                                     RecordScript = RecordScript & "dm.MoveTo(" & HiWord(RetXY) & ", " & LoWord(RetXY) & ")\r\n"
  64.                                 End If
  65.                             End If
  66.                         Else                // 前台
  67.                             If RelaMove Then
  68.                                 RecordScript = RecordScript & "MouseMove(" & (dx - OldPointX) & ", " & (dy - OldPointY) & ", true)\r\n"
  69.                                 OldPointX = dx
  70.                                 OldPointY = dy
  71.                             Else
  72.                                 RecordScript = RecordScript & "MouseMove(" & dx & ", " & dy & ")\r\n"
  73.                             End If
  74.                         End If
  75.                     End If
  76.                 End If
  77.             Case 513, 514, 516, 517, 519, 520    // WM_LBUTTONDOWN, WM_LBUTTONUP, WM_RBUTTONDOWN, WM_RBUTTONUP, WM_MBUTTONDOWN, WM_MBUTTONUP
  78.                 If NewTime <> OldTime Then
  79.                     RecordScript = RecordScript & "Delay(" & (NewTime - OldTime) & ")\r\n"
  80.                     OldTime = NewTime
  81.                 End If
  82.                 If WindowMode Then    // 后台
  83.                     If GetForegroundWindow() = RecordWindow Then
  84.                         If Window_GetRoot(Window_FormMouse()) = RecordWindow Then
  85.                             RecordScript = RecordScript & "dm.MoveTo(" & HiWord(RetXY) & ", " & LoWord(RetXY) & ")\r\n"
  86.                             If wParam <> 519 Then
  87.                                 RecordScript = RecordScript & KeyTblDM[wParam] & "\r\n"
  88.                             End If
  89.                         End If
  90.                     End If
  91.                 Else                // 前台
  92.                     If RelaMove Then
  93.                         RecordScript = RecordScript & "MouseMove(" & (dx - OldPointX) & ", " & (dy - OldPointY) & ", true)\r\n"
  94.                         RecordScript = RecordScript & KeyTbl[wParam] & "\r\n"
  95.                         OldPointX = dx
  96.                         OldPointY = dy
  97.                     Else
  98.                         RecordScript = RecordScript & "MouseMove(" & dx & ", " & dy & ")\r\n"
  99.                         RecordScript = RecordScript & KeyTbl[wParam] & "\r\n"
  100.                     End If
  101.                 End If
  102.             Case 522    // WM_MOUSEWHEEL
  103.                 If NewTime <> OldTime Then
  104.                     RecordScript = RecordScript & "Delay(" & (NewTime - OldTime) & ")\r\n"
  105.                     OldTime = NewTime
  106.                 End If
  107.                 If WindowMode Then    // 后台
  108.                     If GetForegroundWindow() = RecordWindow Then
  109.                         If Window_GetRoot(Window_FormMouse()) = RecordWindow Then
  110.                             If mouseData > 0 Then
  111.                                 RecordScript = RecordScript & "dm.WheelUp()\r\n"
  112.                             Else
  113.                                 RecordScript = RecordScript & "dm.WheelDown()\r\n"
  114.                             End If
  115.                         End If
  116.                     End If
  117.                 Else                // 前台
  118.                     RecordScript = RecordScript & "MouseWheel(" & mouseData & ")\r\n"
  119.                 End If
  120.         End Select
  121.     End If
  122. End Event
复制代码
大家也可以把代码记录成自己喜欢的格式,我这里用了大漠插件,各位也可以尝试换成乐玩之类的插件,这个脚本的可玩性还是很大的,甚至用按键再开发一个按键,也不无可能哦。

3#

再插:之前上传的源代码和EXE整错了…… 我就说怎么附件那么大呢,sorry…… 马虎了

4#

按键X是啥,在哪下载?

5#

救命啊

//窗口句柄:527170 (527170)
// 窗口标题:Meta Business Suite - Google Chrome
// 窗口类名:Chrome_WidgetWin_1
// 后台配置
Dim DisplayMode = "dx"
Dim MouseMode = "windows"
Dim KeyboardMode = "windows"
// 初始化
Import "dm.dll"
dm.BindWindow(527170, DisplayMode, MouseMode, KeyboardMode, 0)

语法错误:脚本 我的脚本1 ,第16行,第3个字符:(错误码0)没有找到合法的符号。
语法错误:脚本 我的脚本1 ,第10行,第18个字符:(错误码0)没有找到合法的符号。
语法错误:脚本 我的脚本1 ,第9行,第15个字符:(错误码0)没有找到合法的符号。
语法错误:脚本 我的脚本1 ,第8行,第17个字符:(错误码0)没有找到合法的符号。这个不能直接用

6#

,

大佬录制出来的文本不能直接用

7#

怎么用啊

8#

怎么出现一大瓶错误的?

9#

请问下,后台按键,试了DX WINDOWS,都没反应,应该怎么解决

发新话题 回复该主题