Files
winconfig/configs/autohotkey/NewTxt.ahk

34 lines
671 B
AutoHotkey

#Requires AutoHotkey v2.0
;Mit Strg, Shift + M wird ein leeres Textfile erzeugt.
#HotIf ("ahk_class CabinetWClass")
^+m::
{
WinID := WinGetID("ahk_class CabinetWClass")
CurrentPath := GetPath(WinID)
CreateFile(CurrentPath)
return
}
#HotIf
;Ermittelt den aktuellen Pfad
GetPath(_hwnd)
{
for w in ComObject("Shell.Application").Windows
if (w.hwnd = _hwnd)
{
path := StrReplace(w.LocationURL, "file:///")
return StrReplace(path, "%20", " ")
}
}
;Schreibt die Datei
CreateFile(path)
{
file := path "/NewFile.txt"
if FileExist(file)
{
MsgBox "NewFile.txt bereits vorhanden"
return
}
FileAppend "", file
}