最好的AutoHotKey宏?

时间:2020-03-06 14:24:15  来源:igfitidea点击:

我将AutoHotKey用于Windows宏。最常见的是,我用它来定义启动/聚焦于特定应用程序的热键,并使用它来将即时电子邮件发送到我的待办事项列表中。我还有一个紧急程序,它会杀死我所有占用大量内存的应用程序(Outlook,Firefox等)。

那么,有没有人可以分享任何出色的AHK宏?

解决方案

AutoHotKey论坛中有很多不错的东西:

http://www.autohotkey.com/forum/forum-2.html&sid=8149586e9d533532ea76e71e8c9e5b7b

有多好?确实取决于我们想要/需要什么。

非常简单实用的代码段:

SetTitleMatchMode RegEx ;
; Stuff to do when Windows Explorer is open
;
#IfWinActive ahk_class ExploreWClass|CabinetWClass
    ; create new folder
    ;
    ^!n::Send !fwf

    ; create new text file
    ;
    ^!t::Send !fwt

    ; open 'cmd' in the current directory
    ;
    ^!c::
        OpenCmdInCurrent()
    return
#IfWinActive

; Opens the command shell 'cmd' in the directory browsed in Explorer.
; Note: expecting to be run when the active window is Explorer.
;
OpenCmdInCurrent()
{
    WinGetText, full_path, A  ; This is required to get the full path of the file from the address bar

    ; Split on newline (`n)
    StringSplit, word_array, full_path, `n
    full_path = %word_array1%   ; Take the first element from the array

    ; Just in case - remove all carriage returns (`r)
    StringReplace, full_path, full_path, `r, , all  
    full_path := RegExReplace(full_path, "^Address: ", "") ;

    IfInString full_path, \
    {
        Run, cmd /K cd /D "%full_path%"
    }
    else
    {
        Run, cmd /K cd /D "C:\ "
    }
}

我一直在使用这个,通常是为了快速访问MySQL命令行。

http://lifehacker.com/software/featured-windows-download/make-a-quake+style-command-prompt-with-autohotkey-297607.php

;我在开始菜单中有此设置,以便在重新启动计算机后戴上耳机时不会损坏耳朵

sleep, 5000
SoundSet, 1.5 ; really low volume

我使用AutoHotKey创建新的Outlook对象

; Win + Shift + M =新电子邮件

#+m::  Run "mailto:"

;外表

#^M::  Run "%ProgramFiles%\Microsoft Office\Office12\OUTLOOK.EXE" /recycle

; Win + Shift + A =创建新的日历约会

#+A::  Run "%ProgramFiles%\Microsoft Office\Office12\OUTLOOK.EXE"/c ipm.appointment

; Win + Shift + T =创建新任务
; Win + Shift + K =新任务

#+T::  Run "%ProgramFiles%\Microsoft Office\Office12\OUTLOOK.EXE"/c ipm.task
#+K::  Run "%ProgramFiles%\Microsoft Office\Office12\OUTLOOK.EXE"/c ipm.task

在所选文本/单词上添加引号
在写电子​​邮件或者编码时很有用...

双击单词,按Win + X,并在引号内

; Win + X
#x:: ; Attention:  Strips formatting from the clipboard too!
Send ^c
clipboard = "%clipboard%"
; Remove space introduced by WORD
StringReplace, clipboard, clipboard,%A_SPACE%",", All
Send ^v
return