Last active
August 16, 2019 19:58
-
-
Save simshaun/565fb79e1a42c6ebf644070c43ad8a7d to your computer and use it in GitHub Desktop.
AutoHotKey script that makes Ctrl+Shift+T create a new file while in Windows Explorer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Ctrl + Shift + T //// When Windows Explorer active, create new file | |
#IfWinActive, ahk_exe Explorer.EXE ahk_class CabinetWClass | |
^+t:: | |
WinGetTitle, currentWinTitle, A | |
if InStr(currentWinTitle, "\") ; If the full path is displayed in the title bar (Folder Options) | |
currentPath := currentWinTitle | |
else if InStr(currentWinTitle, ":") ; If the title displayed is something like "DriveName (C:)" | |
{ | |
currentPath := SubStr(currentWinTitle, -2) | |
currentPath := SubStr(currentPath, 1, -1) | |
} | |
else ; If the full path is NOT displayed in the title bar, https://autohotkey.com/boards/viewtopic.php?p=28751#p28751 | |
for window in ComObjCreate("Shell.Application").Windows | |
{ | |
try currentPath := window.Document.Folder.Self.Path | |
SplitPath, currentPath, title | |
if (title = currentWinTitle) | |
break | |
} | |
if (currentPath != "") { | |
InputBox, filename, Create new file, Filename? | |
if (filename != "") { | |
FileAppend,, %currentPath%\%filename% | |
} | |
} | |
return | |
#IfWinActive |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment