当前位置:  开发笔记 > 前端 > 正文

最好的AutoHotKey宏?

如何解决《最好的AutoHotKey宏?》经验,为你挑选了4个好方法。

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

那么,有没有人有任何好的AHK宏可以共享?



1> Eli Bendersk..:

非常简单实用的片段:

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:\ "
    }
}



2> Peter Gfader..:

在所选文本/单词上添加周围的引号在
编写电子邮件或编码期间有用...

Doubleclick单词,点击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



3> EvanBlack..:

这是一个如此简单但有用的脚本:

^SPACE::  Winset, Alwaysontop, , A

使用CTRL + Space将任何窗口始终设置在顶部.



4> Bård..:

; 我在开始菜单中有这个,以便在重新启动计算机后戴上耳机时不会毁了我的耳朵

sleep, 5000
SoundSet, 1.5 ; really low volume

推荐阅读
携手相约幸福
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有