Forum Home
Press F1
 
Thread ID: 109652 2010-05-17 11:00:00 Any way to create new text file anywhere? CCF (6760) Press F1
Post ID Timestamp Content User
885672 2010-05-17 11:00:00 Hey ya guys

Just got a quick question, Im aftering a method that can allow me to create a new text file in a folder in an instant. Something along the line of a hotkey or via the context menu. And I dont mean the traditional Right Click>New>Text Document. I need something that I can do within a click or a press of a button.

At the moment Ive been searching for some hacks or mods the explorer tool bar to incorporate this function, but sadly such usage on creating a new text file is not so common.

So if any one has some tips or hints on the ability to create new text document in an instant or within a click or press of a button, please let me know :)

Thank you guys in advance :thanks
CCF (6760)
885673 2010-05-17 11:17:00 Do you want it to open with a new blank txt file, or a shut one as you described with the right click. wainuitech (129)
885674 2010-05-17 11:24:00 Yeah, pretty much just a new text document in a folder like it would be as if I used the usual right click>new>... method. But if it is able to be opened up after it is created, I am also fine with that, would save me a few clicks to get it opened ^^ CCF (6760)
885675 2010-05-17 11:25:00 Probably a batch file or script would be the way to go.

Here's a mthod to create a text file with a file list in it. And add to the right click menu.

www.theeldergeek.com
Sweep (90)
885676 2010-05-17 11:35:00 Well if you wanted to use notepad, you could just put a hotkey under its properties alongside shortcut key. You wouldnt have to make a shortcut for it .

It wouldnt be in any particular folder. But, all you would do, is press a key / an F key, and it'll run
Speedy Gonzales (78)
885677 2010-05-17 11:49:00 Hey ya guys

Thanks for the prompt update.

The site's instruction is close to what Im looking for, just now need to find a way to call it in any folder and pick up its dir...majority of the time, the text file would be created inside the folder, rather than prior to entering the folder. Though great stuff, does give me a some more ideas on how I can go about doing this.

As for the notepad shortcut property, I did look into that, but sadly the need to Save As is a put off ><. Very close but not quite there v_v
CCF (6760)
885678 2010-05-17 13:30:00 Hey ya guys

Sort of managed to get a work around for the problem. This is for future reference for anyone who is aftering the same functionality.

1. Create a .bat file with the following command
-------------
IF EXIST info.txt goto exists
echo on>info.txt
exit
goto end
:exists
echo on>info2.txt
exist
:end
-------------

2. Create a semi-context menu link to the file by creating a new registry key with a command key under [HKEY_CLASSES_ROOT/*/shell]

Example: HKEY_CLASSES_ROOT/*/shell/NewTxt/Command

3. Change the Command Default value to the path of where the .bat file was save/located at.

Example: C:\addnewtxt.bat

So now, whenever you right click on a file in any folder, a NewTxt command will be available for you to create a new text file. However right clicking in empty space within any folder wont give the correct context menu with the NewTxt command.



Although my problem is slightly solve, Im still abit unsatisfied. For 2 reasons:

1. The code cant detect existing info.txt files. Does any one know how I can modify the code to detect existing info.txt file and create another with an auto-increment number? Btw, Im no coder, hence the question ^^

2. The NewTxt command only displays in the context menu when clicked on a file, not in empty space. Anyone know how I can move the command into your typical context menu, where it will display it when right click in an empty space in a folder?


Thank you in advance ^^
CCF (6760)
885679 2010-05-17 20:40:00 I notice in the registry that there is a key called

HKLM\SOFTWARE\Classes\Directory\Background\shellex \ContextMenuHandlers\

Looks like where you should be starting...
MushHead (10626)
885680 2010-05-17 20:42:00 To create a system where the number increments each time you create another, you would need to use a FOR loop. For more details type FOR /? at the command prompt or search Google. ryanjames.powell (13554)
885681 2010-05-17 23:48:00 FWIW, I just create shortcuts to Word Pad & New Word Doc, then drag them down to the Task Bar. May need to unlock it.
Left click opens them, always visible, can delete the Desktop shortcuts if wanted.
Don
donread (6401)
1 2