如何使 F1 成为 Windows XP 中用于创建新文件夹的热键?

如何使 F1 成为 Windows XP 中用于创建新文件夹的热键?

如何F1在 Windows XP 中将热键设置为创建新文件夹?

我对编程或脚本不太了解。AutoHotkey 可以做到这一点吗?

答案1

是的。使用文件创建目录

windowText =
line =
path =
name =

$F1::                                                   ;the $ locks the keystroke so you don't get Windows Help
    IfWinNotActive, ahk_class CabinetWClass
        Return                                          ;If the active window is not an explorer window, do nothing
    WinGetText, windowText, ahk_class CabinetWClass,    ;get text info
    StringSplit, line, windowText, `n                   ;take the first line of windowText this will be "Address: path"
    StringReplace, path, line1, Address: `              ;trim off Address: 
    StringTrimRight, path, path, 1                      ;trim off new line character at the end
    InputBox, name, MakeDirF1, Enter the name of the new folder.    ;get a name
    If name == ""                                       ;if name is blank
        name := "New Folder"                            ;then set name
    FileCreateDir, %path%\%name%                        ;create the folder
    If ErrorLevel == 1                                  ;check for errors
        MsgBox, Error!`n`n%A_LastError%                 ;message box if error
    Return

相关内容