2

Can someone please tell me how to create a new keyboard shortcut for creating a new text file?

I have installed Autohotkey but I don't know how to specify script. I want to use Ctrl + Alt + N as keyboard shortcut for new file creation.

Please tell me script for this shortcut as their tutorial seems to be of not much help.

3 Answers 3

3

Just do this.

Type this into Notepad and save as Notepad.bat.

START "" notepad.exe

enter image description here

Next save Notepad.bat in your documents like below or another Directory.

I saved mine here C:\Users\MBurris\Documents\Notepad

enter image description here

Next Right click and make a shortcut. Drag this shortcut to your desktop. Right click the shortcut and rename it to Notepad. enter image description here

Now add your hotkey to the shortcut. Cntrl+Alt+N

enter image description here

Optional.

Finally to make this look clean.

You have the option to hide the shortcut.

Open Cmd and type attrib Notepad.lnk +s +h

enter image description here

Thats it now just use Cntrl+Alt+N and Notepad will open up.

enter image description here

Note: to unhide this use

attrib Notepad.lnk -s -h
2
  • Thanks, it is not exactly what I wanted but its close.
    – Rolen Koh
    Apr 27, 2016 at 11:53
  • 2
    Well what do you want then? You got two good answers, neither of which you built upon or clarified. What do you mean by "creating a new text file"?... do you want it saved on disk somewhere and opened in an editor? Do you want an empty text file sitting somewhere on your hard drive?
    – JJohnston2
    May 3, 2016 at 5:57
3

Using AutoHotkey:

!^n::
if WinActive("ahk_class Progman") or WinActive("ahk_class WorkerW") ; desktop
{
    FileAppend,, %A_Desktop%\New Textfile.txt
    Run, %A_Desktop%\New Textfile.txt
}
else
if WinActive("ahk_class CabinetWClass") ; explorer
{
    for window in ComObjCreate("Shell.Application").Windows
    try Fullpath := window.Document.Folder.Self.Path
    FileAppend,, %Fullpath%\New Textfile.txt
    Run, %Fullpath%\New Textfile.txt
}
return
1
  • Thanks, it is not exactly what I wanted but its close.
    – Rolen Koh
    Apr 27, 2016 at 11:53
0

Windows Explorer keyboard shortcut (without AutoHotkey)

In Windows Explorer, you can hit Alt+F, W, T to create a new text file in the current folder.

Explanation

  • Alt+F: Opens the File menu of Windows Explorer
  • W: Opens the New menu
  • T: Selects the Text Document entry

Menu File - New - Text Document

AutoHotkey

You could simulate those keystrokes with an AutoHotkey script mapped to the Ctrl+Alt+N keyboard shortcut you want:

!^n::
Send, !f
Send, w
Send, t
return

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .