Autohotkey配置

来源:互联网 发布:淘宝反黑联盟 编辑:程序博客网 时间:2024/04/20 06:57

From: http://hi.baidu.com/kkernel/blog/item/51fe0d03781982e308fa93b1.html


; IMPORTANT INFO ABOUT GETTING STARTED: Lines that start with a
; semicolon, such as this one, are comments.  They are not executed.

; This script has a special filename and path because it is automatically
; launched when you run the program directly.  Also, any text file whose
; name ends in .ahk is associated with the program, which means that it
; can be launched simply by double-clicking it.  You can have as many .ahk
; files as you want, located in any folder.  You can also run more than
; one ahk file simultaneously and each will get its own tray icon.

; SAMPLE HOTKEYS: Below are two sample hotkeys.  The first is Win+Z and it
; launches a web site in the default browser.  The second is Control+Alt+N
; and it launches a new Notepad window (or activates an existing one).  To
; try out these hotkeys, run AutoHotkey again, which will load this file.

;# 表示Windows键, ^表示CTRL键  !表示ALT键

#z::Run www.autohotkey.com

^!n::
IfWinExist Untitled - Notepad
WinActivate
else
Run Notepad
return

!c::
IfWinExist Untitled - chrome
WinActivate
else
Run C:\Documents and Settings\guowenxue\Local Settings\Application

Data\Google\Chrome\Application\chrome.exe
return

!e::
IfWinExist, ahk_class EVERYTHING
WinActivate
else
run C:\Program Files\Everything\Everything.exe
return

!s::
Run E:\SecureCRT V5.5\SecureCRT.EXE
return

!l::
Run C:\Program Files\TTERMPRO\ttermpro.exe
return

!x::
Run C:\Program Files\Kingsoft\PowerWord PE\XDict.exe
return

!f::
Run C:\Program Files\Mozilla Firefox\firefox.exe
return

!t::
Run C:\Program Files\TTPlayer\TTPlayer.exe
return

!m::
Run D:\Program Files\Foxmail\Foxmail.exe
return

!h::
Run D:\Program Files\HyperSnap-DX6.31.01\HprSnap6.exe
return

!p::
Run C:\Program Files\Source Insight 3\Insight3.Exe
return

!v::
Run E:\vmware6\vmware.exe
return

!d::
Run E:\OK6410\实用工具\dnw.exe
return

#w::
Run D:\workpath
return

#c::
Run C:\linux
return

#s::
Run D:\datesheet
return

;定义SecureCRT的一些粘贴快捷键

#ifWinActive ahk_class VanDyke Software - SecureCRT
; set cramfs bootargs
!1::
send set bootcmd 'nand read 20000000 A0000 500000;bootm 20000000'
send {enter}
send set bootargs 'noinitrd root=/dev/mtdblock5 init=/linuxrc'
send {enter}
send save
send {enter}
return

;update booloader u-boot image
!2::
send tftp 20000000 u-boot.bin;protect off 0xD0008400 0xD003FFFF;erase 0xD0008400 0xD003FFFF;cp.b 20000000

d0008400 $(filesize)
send {enter}
return

;update linux kernel image and cramfs root file system image
!3::
send nand erase 000a0000 500000;tftp 20000000 uImage.gz;nand write 20000000 000a0000 500000; nand erase 005a0000

500000;tftp 20000000 nrfs.cramfs;nand write 20000000 005a0000 500000;reset
send {enter}
return

!4::
send cd /tmp/ && tftp -gr master_n300_apps_basic.nup 192.168.4.15 && nup master_n300_apps_basic.nup
send {enter}
return

!5::
send cd /tmp && tftp -gr N300_firmware.nup 192.168.4.15 && nup N300_firmware.nup
send {enter}
return

!7::
send comport -ioctl /dev/ttyUSB0
return

!8::
send comport -ioctl /dev/ttyUSB0 1 1
send {enter}
return

!9::
send comport -d /dev/ttyUSB0
send {enter}
send AT
send {enter}
return

^1::
send make && rm -f /tmp/tftp/signpad && cp signpad /tmp/tftp
send {enter}
return

^2::
send rm -f signpad && tget signpad && ./signpad
send {enter}
return

;重定义cmd命令提示符,支持Ctrl+c 复制,ctrl+v 粘贴, ctrl+w 关闭,  ctrl+f 查找
#ifWinactive

; Redefine only when the active window is a console window   
#IfWinActive ahk_class ConsoleWindowClass  

; Close Command Window with Ctrl+w  
$^w::  
WinGetTitle sTitle  
If (InStr(sTitle, "-")=0) {   
Send EXIT{Enter}  
} else {  
Send ^w  
}  

return   


; Ctrl+up / Down to scroll command window back and forward  
^Up::  
Send {WheelUp}  
return  

^Down::  
Send {WheelDown}  
return  


; Paste in command window  
^V::  
; Spanish menu (Editar->Pegar, I suppose English version is the same, Edit->Paste)  
Send !{Space}ep  
return  


; find in command window  
^F::  
; Spanish menu (Editar->find, I suppose English version is the same, Edit->find)  
Send !{Space}ef  
return  


^3::
send ping 10.78.28.15
send {enter}
return

#ifWinactive


==================================================================================================

From: http://hi.baidu.com/solari_bian/blog/item/99e5434751d9c60772f05d7f.html

autohotkey的命令形如以下:

#space::run google.com.hk

#space指明快捷键,::后面的内容指明要执行的内容

常用的热键命令:

#:windows

^:ctrl

!:alt

 

像:#space::run google.com.hk

这样的叫做单行热键

如果需要一个热键执行多行内容的话,可以这样写:

#n::

Run http://www.google.com

Run Notepad.exe

return

即::后换行,最好一行写一个return

对于不是系统绑定的程序或文件,需要指明其绝对路径才可以执行。

例如:

Run %A_ProgramFiles%\Winamp\Winamp.exe

其中%a_programfiles%是一个autohotkey的嵌入型变量(这些变量是不可改变的),使用嵌入型变量有利于是的脚本具有可移植性。

 

等待记事本关闭后再打开记事本。

RunWait Notepad

MsgBox The user has finished (Notepad has been closed).

 

关于传递参数、制定工作目录等如下:

【1】win+z打开两个记事本,一个最大化,一个最小化

#z::

Run, Notepad, , max

Run, Notepad, , min

return

 

【2】打开命令行,定位到指定的目录:

#c::Run, %comspec% /k, C:\My Documents

打开文件属性,打印文本文件

Run, properties "C:\Address List.txt"

Run, print "C:\Address List.txt"

 

输出一段字符,其中{Enter}相当于按下回车键:

^!s::

Send Sincerely,{Enter}John 萨特的:

return


原创粉丝点击