一个非常棒的AutoHotKey脚本

[quote]; Function to run a program or activate an already running instance
RunOrActivateProgram(Program, WorkingDir="", WindowSize=""){
SplitPath Program, ExeFile
Process, Exist, %ExeFile%
PID = %ErrorLevel%
if (PID = 0) {
Run, %Program%, %WorkingDir%, %WindowSize%
}else{
WinActivate, ahk_pid %PID%
}
}
^!w::RunOrActivateProgram("D:\Program Files\EditPlus\editplus.exe")
^!f::RunOrActivateProgram("C:\Program Files\mozilla firefox\firefox.exe")
^!o::RunOrActivateProgram("C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE")
^!c::RunOrActivateProgram("D:\Program Files\SecureCRT+FX\SecureCRT.exe")
^!d::RunOrActivateProgram("D:\Program Files\Q-Dir\Q-Dir.exe")
^!e::RunOrActivateProgram("D:\eclipse\eclipse-java-helios-win32\eclipse.exe")[/quote]

我觉得RunOrActivateProgram是一个非常棒的万能函数, 我用它定义了一些快捷键, 在我常用的程序之间切换

你可能感兴趣的:(AutoHotKey)