[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 817
  • Last Modified:

Keyboard shortcut to create a text document like the Context Menu New text Document

I would like to find a method of creating a keyboard shortcut to create a new blank text file in Explorer. It would have the same functionality as the right-click context menu >New >Text Document.

I don't know if this is easy or difficult, the solution has certainly evaded me. I'll rais the points if people think it's a difficult question.

--gr3gw
0
gr3gw
Asked:
gr3gw
  • 7
  • 4
  • 3
2 Solutions
 
Mark BradyCommented:
What sort of keyboard do you have....one with shortcut buttons on it or a standard 101 keyboard ?

If you don't have an internet designed keyboard I doubt you can assign a shortcut to a key from windows xp.  you could do this through an application using a key hook then you would assign the command something like this....


notepad.exe new.txt

that would open notepad and ask you if you want to create that fie.  You could assign the function to any key.

Regards
Elvin
0
 
gr3gwAuthor Commented:
Thanks for that suggestion, Elvin. The "notepad.exe new.txt" command will work but I'd really like something that works as smoothly as the right-click>New>Text Document but even faster and more conveniently than the right-click method, ie a kjeyboard shortcut. Using Notepad in this wayinvolves extra steps.

The reason I'm after this feature is that I like to create comments or reminders in folders using the names of text files.

Even my trusted Quickeys doesn't have this feature.

The Context Menu must invoke some code to create the empty text document. I thought if I could access it directly I could create a keyboard shortcut.

0
 
Mark BradyCommented:
I see where you are heading however, even if you could find the code that xp uses on the contet menu (wouldn't be to hard) you still can't assign it to a key on your keyboard.  You need an application for this (like a small Delphi app or something).  In an application you can create a file and either give it a filename or leave it blank to open notepad with an 'untitled' document ready for you to start typing and save.  Not sure what else I can tell you unless you can give me an example of exactly what you are trying to do...

Elvin
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
Dark_KingCommented:
Create a shortcut to the program. Place the
shortcut in the Start Menu or onto the Desktop and associate a hotkey
to it.

Right click > property > shortcut. And then click short commando and then ctrl + key you want.
0
 
gr3gwAuthor Commented:
Thanks for the information on assigning keyboard shortcuts, Dark_King. I'm pretty conversant with assigning keys, it's the program or code I need. Creating a empty text file sounds trivial but a quick simple way to do it is proving evasive. For example, using Notepad as suggested by Elvin is not quick and simple as it requires several steps and the use of the mouse.
0
 
gr3gwAuthor Commented:
Elvin,

Apologies for not being as clear as I should be. I don't actually type in the document, I use the document name for info. Here's an example. Sometimes I want to keep track of the version of a file. For example, if I'm playing around with Boot.ini, I want to know what version it is without opening the file. You can't add a version number to the Boot.ini filename as it will no longer work, so what I do is create a text file in the same directory as Boot.ini and name it something like 'Boot.ini Disk A, Partition 1, Version 1.05.txt'. This text file sits next to Boot.Ini when the folder is listed alphabetically and so I can see at a glance what the Boot.ini version is. The folder listing looks like this:

     boot.ini
     boot.ini Disk A, Partition 1, Version 1.05.txt

I use this technique quite a lot to make notes about files that are not self explanatory or for which I need a reminder should I ever come back to use again.

What I normally do, taking the above example, is:

     right-click on the white space in Explorer, select New and then Text Document
     (the new text document name is highlighted ready for renaming)
     type the comment  - "Boot.ini Disk A, Partition 1, Version 1.05.txt"

This is pretty quick but sometimes I find it is not quick enough, especially when I'm really concentrating on the over-all task. What I really want to be able to do is enter a shortcut key (eg Control/Shift/T), which will do the equivalent of right-click> New> Text Document and leave the filename highlighted, then type my comment as the filename. This way may right hand wouldn't have to leave the keyboard.

The Notepad approach is the way to go but Notepad is not the right program. It's interactive and can't run silently. I suspect any heavy duty text editor that can run silently will have too large a overhead to do the job quickly. That's why I was asking about the technique that the right-click> New> Text Document method was using.

--gr3gw
0
 
Mark BradyCommented:
I see what you are trying to do now, thanks for the clarification.  It seems that getting microsofts exact coding is a hard task.  As Windows explorer is an actual program, the code is burried inside the exe so cannot find how they do it.  Everything I have read on this subject leads me to believe you need a smmall app running in the background that when a hotkey is pressed will open with a filename dialog ready for your typing into.  Upon clicking a button it will find the previously active window (the folder that was open when you invoke the key press) and create a txt file with the name you typed in.

Sorry I can't help you achieve this but good luck with it.

Elvin
0
 
Dark_KingCommented:
Only way I now to make a blank new file is with "echo" like this echo "" > test.txt

If you use context menu and run a batch file you cold call it like this
cmd.exe /c myfile.bat %1

and inside this batch file some thing like this

Echo "" > %~dp1%~n1%date%%~x1
0
 
Dark_KingCommented:
Sorry I sholde have explain some of this...

%1 is holding the path and filename you right click, if it is use from  context menu handler.

%~dp1 = expands %1 to a drive letter and path only
%~n1 = expands %1 to a file Name
%date% = to days date
%~x1 = expands %1 to a file eXtension
0
 
Dark_KingCommented:
I see you want .txt file, change last flag
Echo "" > %~dp1%~n1%date%.txt
0
 
Dark_KingCommented:
or
copy %1 %~dp1%~n1%date%%~x1
to have a copy of file you right click on

ther also posibly to mak a program thats take car of version number, If I get time I see if I cold make some.
0
 
Dark_KingCommented:
I made this application that’s give you a Context Menu to make new file.
This is only a test to se if it is what you need.
I can add short key and fix thing you want later.

I grabbed this from some cod I found and added some stuff, it cold be much smaller
but I haven’t time today to work more on this.

http://big.park.se/files/extra/DarkContextMenu/DarkContextMenu.zip

Uses:
Register.bat = install program
UnRegister.bat = uninstall program

Right click a file and click “Create new txt file”
A box with filename and some sample txt is popup, enter what you want.

0
 
gr3gwAuthor Commented:
Dark_King,

Thanks for all the work you've done so but no need to do more. The version number is information I type in and sometimes my comments are nothing to do with version numbers, for example, "delete this after March".

I've realised by reading through your work that what I've asked for is, in fact, impossible. A shortcut will invoke a program and that program must know where to create the empty text file. Having to tell the program where to create the file is self-defeating. The context menu knows which directory to work in *because of the click*, that's the context.

Hence, my conclusion is that a shortcut cannot be better than the context menu.

I've learnt quite a lot from your work and will assign you a share of the points for helping me to realise my error.

--gr3gw
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 7
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now