资源预览内容
第1页 / 共23页
第2页 / 共23页
第3页 / 共23页
第4页 / 共23页
第5页 / 共23页
第6页 / 共23页
第7页 / 共23页
第8页 / 共23页
第9页 / 共23页
第10页 / 共23页
亲,该文档总共23页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述
AutoHotKey使用教程http:/hi.baidu.com/pikkaAutoHotKey使用教程(一)-何为AutoHotKey?AutoHotKey是一个免费开源的小软件,很小(只有1964 KB),但是功能却非常强大,它几乎可以做键盘、鼠标和操纵杆可以做的任何事情。它可以把人力完全的释放出来,前提只要你编写一个后缀为.ahk的脚本。如果你愿意,你完全可以把你写的script理解为一个机器人,它可以做你想让它做的任何事情。 AutoHotKey在国外使用的很普遍,国内也有很大的用户群,大家只要Google一下就知道了,AutoHotKey之前的版本是AutoIt2,现在newest的版本是AutoIt3,但是AutoHotKey还是一个比较经典的版本,最新的版本是1.0.47.04,建议大家下载一下,有什么使用心得,多交流哈,呵呵。我会定期在我的博客上更新使用心得,大家多关注啊。AutoHotKey使用教程(二)-一个简单的例子使用AutoHotKey编写脚本非常简单,现在我们就来开始编写我们的第一个简单的脚本吧。使用notepad或者其他你熟悉的文本编辑器,新建一个文件,使用.ahk作为后缀名,例如test.ahk 。把下面的代码拷贝进去,保存退出,双击执行一下。 代码:MsgBox,你好,欢迎关注风追月博客 n 请继续关注哈run, http:/hi.baidu.com/pikka看到什么结果了吗?神奇吗?简单吗?呵呵如果感兴趣的话,我还会在后面的章节中,更加详细得讲解。AutoHotKey使用教程(三)-定义属于自己的热键通过本节的学习,你可以自定义热键快速启动常用的程序、文档、目录、网址和WINDOWS的常用功能(如:增大减小音量、系统静音开关、弹出关闭光驱、打开控制面板模块属性等等)。在日常的工作中,它的确可以帮助您节省不少鼠标频繁点击的时间,从而大大的提高工作效率。我们先来看一段简单的代码:#n:Run Notepadreturn在上面的代码中,#代表windows键(一种修饰符), return表示结束热键定义。如果一个热键定义中只有一个语句,如上面的例子,那么这条语句就可以放在:的后面,不需要添加return:#n: Run Notepad 如果热键包含多个按键,组合键连续的放在一起(不需要考虑顺序),下面的例子即使用!来代替Control+Alt :!s:Send Sincerely,enterJohn Smith ; This line sends keystrokes to the active (foremost) window.return 你可以同时定义多个热键,它们触发相同的事件,只要把热键“垂直”定义即可。Numpad0:Numpad1:MsgBox Pressing either Control+Numpad0 or Control+Numpad1 will display this message.return 如果你要禁用某个热键,非常简单,只要在return之前不写任何语句即可,下面的例子就禁用的右边的Windows键RWin:returnAutoHotKey使用教程(四)-一些常用的修饰符符号 用法#Windows键!AltControl+Shift&逻辑与,把多个按键或鼠标组合成一个自定义键,Windows 95/98/Me无法识别 一对按键中的左边的按键,如 一对按键中的右边的按键*通配符,表示热键被按下时,即使同时还有其他的按键按下,依然有效*#c:Run Calc.exe ; Win+C, Shift+Win+C, Ctrl+Win+C, etc. will all trigger this hotkey.*ScrollLock:Run Notepad ; Pressing Scrolllock will trigger this hotkey even when modifer key(s) are down.热键被触发后,动作不会被阻塞AutoHotKey使用教程(五)-按键重映射按键重映射的语法格式:OriginKey:DestinationKey。请看下面的例子:a:b 在上面的例子中体会以下几点:1) 使用键盘敲“a“,会自动映射成”b“2) 敲”Shift + a “ 呢? B3) 敲”capslock + a “ 呢? B4) 敲”b“ 呢? 还是b a:B1) 使用键盘敲“a“,会自动映射成”B“2) 敲”Shift + a “ 呢? B3) 敲”capslock + a “ 呢? b总结:”Shift + a “ 跟 “a“的效果是一样的,”capslock + a “是按映射后在转换大小写。 鼠标的重映射语法跟按键重映射一致。RAlt:RButton ; Makes the right Alt key behave like the right mouse button.RWin:Return ; Disables the right Windows key by having it simply return 使用#IfWinActive/Exist语句可以控制重映射生效的窗口。#IfWinActive ahk_class Notepada:b ; Makes the a key send a b key, but only in Notepad.#IfWinActive ; This puts subsequent remappings and hotkeys in effect for all windows.一段使用键盘控制鼠标的代码,大家有兴趣可以试一试。*#up:MouseMove, 0, -10, 0, R ; Win+UpArrow hotkey = Move cursor upward*#Down:MouseMove, 0, 10, 0, R ; Win+DownArrow = Move cursor downward*#Left:MouseMove, -10, 0, 0, R ; Win+LeftArrow = Move cursor to the left*#Right:MouseMove, 10, 0, 0, R ; Win+RightArrow = Move cursor to the right* Left-click (hold down Control/Shift to Control-Click or Shift-Click).SendEvent BlindLButton downKeyWait RCtrl ; Prevents keyboard auto-repeat from repeating the mouse click.SendEvent BlindLButton upreturn* Right-clickSendEvent BlindRButton downKeyWait AppsKey ; Prevents keyboard auto-repeat from repeating the mouse click.SendEvent BlindRButton upreturnAutoHotKey使用教程(六)-鼠标和键盘按键操作列表鼠标支持以下操作:LButton RButton MButton WheelDown WheelUp 键盘按键支持以下操作:Space - the spacebarTabEnter (or Return)Escape (or Esc)Backspace (or BS)Delete (or Del)Insert (or Ins)HomeEndPgUpPgDnUpDownLeftRightScrollLockCapsLockNumLockNumlock ONNumlock OFFNumpad0NumpadInsNumpad1NumpadEndNumpad2NumpadDownNumpad3NumpadPgDnNumpad4NumpadLeftNumpad5NumpadClearNumpad6NumpadRightNumpad7NumpadHomeNumpad8NumpadUpNumpad9NumpadPgUpNumpadDot (.) NumpadDelNumpadDiv (/)NumpadDiv (/)NumpadMult (*)NumpadMult (*)NumpadAdd (+)NumpadAdd (+)NumpadSub (-)NumpadSub (-)NumpadEnterNumpadEnter1 a A LWin Control (or Ctrl) Alt Shift F1PrintScreen CtrlBreak Pause BreakAutoHotKey使用教程(七)-AutoHotkey脚本AutoHotkey跟tcl等语言一样,是一种解释性语言。从脚本的头部至结尾顺序执行,除非遇到return,exit或者热键、热字符串。一个AutoHotkey脚本如果不包含热键、热字符串、OnMessage或者 GUI等,就会在文件执行完成后推出,否则脚本会处于idle状态以备相应热键、热字符串等操作。的用法类似于c和tcl中的“”,例如t (tab), n (linefeed), and r (carriage return).Autohotkey中逗号和百分号都有专门的意义,如果要表示字符意义,可以使用, %。MsgBox This is ok.MsgBox, This is ok too (it has an explicit comma). AutoHotkey脚本使用“;”注释,“;”跟在需注释的语句之后,注意语句和分号之间只要要有一个空格。如果要注意多个语句可以使用/* */Run Notepad ; This is a comment on the same line as a command./*MsgBox, This line is commented out (disabled).MsgBo
收藏 下载该资源
网站客服QQ:2055934822
金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号