Creating Notepad file
Moderators: white, Hacker, petermad, Stefan2
As Sir_SiLvA mentioned, Shift+F4 allows editing ANY file with specified name, not only TXT files. If this file doesn't exist, TC creates it and opens for editing. Therefore this function may be used for creating of text files. However it may work wrong if you try to create e.g. DOC file (DOC files can't be empty, they are created from templates).
-
- Junior Member
- Posts: 14
- Joined: 2012-12-02, 21:58 UTC
Just use button with command like:
(feel free to use any text editor you like)
Code: Select all
Command: Notepad.exe
Parameters: "%P\File_ID.txt"
-
- Junior Member
- Posts: 14
- Joined: 2012-12-02, 21:58 UTC
OK, thanks. It works but isn't still perfect.
When launch notepad a popup ask if I want create a new file and I click "yes". I would like to eliminate this click.
I was thinking to a bat like:
copy C:\totalcmd\file_id.txt (to active panel but I don't know how)
cd (active panel, but I don't know how)
notepad.exe file_id.txt (or notepad.exe Activepanel/file_id.txt
any ideas?
Thanks
When launch notepad a popup ask if I want create a new file and I click "yes". I would like to eliminate this click.
I was thinking to a bat like:
copy C:\totalcmd\file_id.txt (to active panel but I don't know how)
cd (active panel, but I don't know how)
notepad.exe file_id.txt (or notepad.exe Activepanel/file_id.txt
any ideas?
Thanks
You can use following batch file:
Just clear start path field in the button to make it working with your current panel's path.
Also same may be done w/o batch file with instant commands:
Code: Select all
@echo off
copy nul file_id.txt
start "" "Notepad.exe" file_id.txt
Also same may be done w/o batch file with instant commands:
Code: Select all
Command: cmd.exe
Parameters: /c "copy nul "%P\file_id.txt" & start "" "Notepad.exe" "%P\file_id.txt""
Minimized: Yes
Powershell create new file or open existing file
With POWERSHELL
If not exist File_ID.txt, create it. After that decision, open the file in notepad.exe:
TC Button:
CMD: powershell
Para: the code
Path:
Icon: powershell
[X] run minimized
Note:
for use with TC I had to escape the quote chars " in PS as """
Change 'notepad' with your ' "path\to\editor" '.
- - -
Create on every execution a file with a new ID:
File_ID1.txt
File_ID2.txt
File_ID3.txt
Or formate to pad to length of three digits:
File_ID001.txt
File_ID002.txt
File_ID003.txt
File_ID004.txt
.
If not exist File_ID.txt, create it. After that decision, open the file in notepad.exe:
Code: Select all
$file=$pwd.path+"\File_ID.txt"; if(!$file.Exist){new-item -path $file -type "file"}; notepad $file;
TC Button:
CMD: powershell
Para: the code
Path:
Icon: powershell
[X] run minimized
Note:
for use with TC I had to escape the quote chars " in PS as """
Change 'notepad' with your ' "path\to\editor" '.
- - -
Create on every execution a file with a new ID:
File_ID1.txt
File_ID2.txt
File_ID3.txt
Code: Select all
$id=1; $file=$pwd.path+"""\File_ID$id.txt"""; while(test-path $file){$id++;$file=$pwd.path+"""\File_ID$id.txt"""}new-item -path $file -type """file"""; notepad $file
File_ID001.txt
File_ID002.txt
File_ID003.txt
File_ID004.txt
Code: Select all
$id=1; $file=$pwd.path+"""\File_ID{0:D3}.txt""" -f $id; while(test-path $file){$id++;$file=$pwd.path+"""\File_ID{0:D3}.txt""" -f $id}new-item -path $file -type """file"""; notepad $file
.
-
- Junior Member
- Posts: 14
- Joined: 2012-12-02, 21:58 UTC
Hi. It's working. Thank you.MVV wrote: Also same may be done w/o batch file with instant commands:Code: Select all
Command: cmd.exe Parameters: /c "copy nul "%P\file_id.txt" & start "" "Notepad.exe" "%P\file_id.txt"" Minimized: Yes
I have made a modify, just in case the file "File_Id.txt" is present:
Code: Select all
Command: cmd.exe
Parameters: /c "copy nul "%P\file_id.txt"/-Y & start "" "notepad.exe" "%P\file_id.txt""
Minimized: Yes
Thanks again