diff options
author | John Ankarström <john@ankarstrom.se> | 2020-12-26 15:40:13 +0100 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2020-12-26 15:40:13 +0100 |
commit | d74a7673e1ce534b5723732d9db4630702d01419 (patch) | |
tree | fe4fbace14adf720fbff7751506105bc97a639dc | |
parent | 8819fddff54d549fe56577c9ae92bd8a57d7beaa (diff) | |
download | ahk-d74a7673e1ce534b5723732d9db4630702d01419.tar.gz |
explorer: Fix and improve new text file hotkey
-rw-r--r-- | tt.programs.explorer.ahk | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tt.programs.explorer.ahk b/tt.programs.explorer.ahk index 20296c3..3deb9d6 100644 --- a/tt.programs.explorer.ahk +++ b/tt.programs.explorer.ahk @@ -57,8 +57,22 @@ return ; Create new file ^!n:: -FileAppend,, % ExplorerPath() "\New Text Document.txt" -SendInput, {F5}New Text Document.txt{F2} +path := ExplorerPath() "\" +pre := "Nytt textdokument" +post := ".txt" +if (FileExist(path pre post)) +{ + n := 2 + while (FileExist(path pre " (" n ")" post)) + n += 1 + name := pre " (" n ")" post +} +else + name := pre post +FileAppend,, % name +SendInput, {Esc}{F5} +Sleep, 80 +SendInput, % name "{F2}" return ;; Explorer hotkeys ----------------------------------------------------------- |