Computer (PC) Key Wizard - Keyboard commands and mouse commands
注:说命令之前,先说下基本设置
Detailed tutorial for getting started with Key Wizard:
Computer (PC) Button Wizard—Detailed Tutorial for Beginners
1. Settings
- As shown below, click Settings, Script Format - you can set fonts and other content
The font size has become larger
- Modify file name, script properties
2. Simple and commonly used keys
- 1. Comment and uncomment
If commenting, add "//" in front of it. To uncomment, delete "//"
//牛云说:加微信可以进行技术交流“LYDSfly1207”
//学习按键精灵常用命令
Comes with software
- 2. Commonly used keys
3. Commonly used basic commands - keyboard commands
重点来了,编写脚本的命令现在开始介绍
~1.KeyPress button
- Introduction
KeyPress 键盘虚拟码,次数
//举例:
KeyPress 87,1
//87是W键的按键码,上面的语句表示按W键1次
KeyPress "W",1
//上面的支持按键字符,语句表示按W键1次
如果要用按键码,如何查找按键码呢?如下图,可以查询
- To test, click Debug - Start, and find that w is automatically printed, indicating that it has been called; click Debug again to return
//调用运行命令,打开notepad
Call RunApp("notepad")
//停顿1秒
Delay 1000
//键盘点击W键一次
KeyPress 87, 1
//KeyPress "W",1 这俩一样的效果,用按键码也行,直接用字母也行
~2.KeyDown press and KeyUp pop up (release the key)
- Introduction
//KeyDown 17,1
//17是ctrl键的按键码,上面的语句表示按住ctrl键1次
KeyDown "ctrl",1
//上面的支持按键字符,语句表示按住ctrl键1次
//KeyUp 17,1
//17是ctrl键的按键码,上面的语句表示按住ctrl键1次
KeyUp "ctrl",1
//上面的支持按键字符,语句表示ctrl键1次
- Test ctrl + H, use the keys together
//调用运行命令,打开notepad
Call RunApp("notepad")
//停顿1秒
Delay 1000
//按下ctrl键
KeyDown "ctrl",1
//按键H一次,替换
KeyPress "H",1
//松开ctrl键
KeyUp "ctrl",1
~3.WaitKey Wait for any key to be pressed
- Introduction
Key=WaitKey()
//脚本运行到这一行会暂停,当用户按下键盘后继续执行,并且把用户的按键码保存在变量Key里
- Test: Start printing text, press any key, and print out the text
//调用运行命令,打开notepad
Call RunApp("notepad")
//停顿1秒
Delay 1000
//输入文本
SayString "敲任意键:"
key = WaitKey()
SayString "我是你们的好朋友" & key
4. Commonly used basic commands - mouse commands
注:这里说鼠标命令的话就要结合抓取定位,综合命令去说,这样更有利于掌握用法
~1. Snapshot positioning
First click scratch, a pop-up window will appear, place the mouse on "cat.jpg", "ctrl + alt + 1" the coordinates and color of the image will be displayed at the corresponding position
~2.MoveTo mouse movement
- IntroductionintX
=50
intY=150
MoveTo intX,intY
//把鼠标移动到这个点上 ,将刚才的定位坐标粘贴到这里
MoveTo 816,174
- Test: After startup, the mouse arrow automatically moves to "cat.jpg"
注意:如果你的鼠标移动的偏移了,可能是不兼容的问题
Solution:
First adjust the computer's display settings to 1024 x 768; right-click on the desktop and select Display Settings, and change the monitor resolution to 1024 x 768, 100%, as shown below
Then right-click the sprite icon, select "Compatibility", change the high DPI settings, and check "Replace high DPI scaling behavior"; if the positioning is still inaccurate, restart the computer.
~2.LeftDown: press the left button, LeftUp: click the left button, RightClick: click the left button, and LeftClick: click the left button.
-
IntroductionLeftDown
timesLeftUp
timesRightClick
timesLeftClick
times -
test
这几个命令一起来用一下,我们要做到找到定位目标文件,点击移动到另一个位置,然后右键重命名
步骤:
1.鼠标左键按下
2.拖动
3.左键弹起
4.右键单击
5.重命名
Script
//利用抓抓得到定位,把鼠标移动到(1273,300)文件上
MoveTo 1273,300
//等待一秒,更容易看到运行轨迹
Delay 1000
//鼠标左键按下1次
LeftDown 1
Delay 1000
//移动到(1466,432)位置
MoveTo 1466, 432
Delay 1000
//鼠标左键弹起1次
LeftUp 1
Delay 1000
//鼠标右键点击1次
RightClick 次数
Delay 1000
//进行重命名,快捷点M
KeyPress "M", 1
Delay 1000
//输入文本
SayString "可爱的猫咪"
//回车
KeyPressS "Enter",1
It can be seen that the position has been moved and renamed. The other keys are also used in this way. It is very simple.
~ 3.MouseWheel mouse scrolling, WaitClick press any mouse button to continue
-
Introduction
MouseWheel 1
//Roll the mouse wheel up 1 space
key=WaitClick()
//After the mouse is clicked, return the variable to key, which stores the mouse button you clicked -
test
//点击启动后等待两秒,切换到网页
Delay 2000
//滚轮向下滚动,正数则是向上滚动
MouseWheel -1
//点鼠标任意键继续
key = WaitClick()
//打印出点击的鼠标键
TracePrint "我点击的鼠标键:" & key
After clicking to start, immediately switch to the web page to see the effect. After scrolling, click to end the script.
That’s it for our commonly used keyboard commands and mouse commands. The next chapter will talk about other commands.
Hope it helps you