OO verbessert und ahk hinzugefügt.
This commit is contained in:
34
configs/autohotkey/NewTxt.ahk
Normal file
34
configs/autohotkey/NewTxt.ahk
Normal file
@@ -0,0 +1,34 @@
|
||||
#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
|
||||
}
|
||||
Reference in New Issue
Block a user