如何通过右键单击 – >新建 – >新文本文档来使用autohotkey创建新的文本文件?

我想通过右键单击创建一个新的文本文件 – >新 – >使用AutoHotKey的新文本文档.我该怎么做呢?我是AutoHotKey的新手.

编辑:

使用Autohotkey,您可以为某些任务分配快捷方式,例如运行特定程序(如记事本).你可以通过编写脚本来实现.您可以在Autohotkey网站上找到详细信息.我想编写一个键盘快捷键来手动自动化“右键单击 – >新建 – >新文本文档”功能.

我发现可以通过将以下脚本添加到AutohotKey的现有脚本来完成.

^+t::
  Click, right, 1024, 355 (or any other mouse co-ordinates for that matter)
  Send w
  Send t
 return

但是,当我尝试时,这种语法不起作用.有人能告诉我什么是错的,并告诉我应该如何正确的语法?

最佳答案 正如Ken White所说,你已经在Windows资源管理器中内置了它,右键单击>新>新的文本文档,所以有另一个做同样的事情是没有意义的.

但是,如果您想使用AutoHotKey更有效,更快地创建新的文本文件,那么我会推荐这个脚本

SetTitleMatchMode RegEx
MsgBox, 64, NewTextFile, USAGE: When in a folder in Windows Explorer press Ctrl + Shift + T to create empty text file.`nIf you press multiple times, multiple files will be created (e.g. NewTextFile0.txt, NewTextFile1.txt)

#IfWinActive ahk_class ExploreWClass|CabinetWClass
    ^+t::
        NewTextFile()
        return
#IfWinActive

NewTextFile()
{
    WinGetText, full_path, A
    StringSplit, word_array, full_path, `n
    Loop, %word_array0%
    {
        IfInString, word_array%A_Index%, Address
        {
            full_path := word_array%A_Index%
            break
        }
    } 
    full_path := RegExReplace(full_path, "^Address: ", "")
    StringReplace, full_path, full_path, `r, , all

    IfInString full_path, \
    {
        NoFile = 0
        Loop
        {
            IfExist  %full_path%\NewTextFile%NoFile%.txt
                    NoFile++
                else
                    break
        }
        FileAppend, ,%full_path%\NewTextFile%NoFile%.txt
    }
    else
    {
        return
    }
}

如果您正在运行并且使用Windows资源管理器(或桌面)处于文件夹中,请按Ctrl Shift T创建新文本文件,尽可能多.

https://github.com/ilirb/ahk-scripts/blob/master/executable/source/NewTextFile.ahk

点赞