Use textpad as a command liner

Usage tips, posted by users. No questions here please.

Moderators: AmigoJack, helios, bbadmin, Bob Hansen, MudGuard

Post Reply
OnlyTextPad
Posts: 41
Joined: Sat May 20, 2006 9:10 pm
Location: Helsinki
Contact:

Use textpad as a command liner

Post by OnlyTextPad »

Textpad could be configured with Tools – e.g. Textpad could call externals programs, to which even a Textpad parameters (currently selected text, current opened file, current directory).The idea is to configure the cmd.exe – the Windows XP‘s command interpreter and pass to it any Textpad specific parameters or any cmd commands.
The following actions have to be performed in order to get this functionality:
- Display Preferences dialog box ( Alt + C , P)
- Select Tools , Add DOS Program
- type the full path to the cmd.exe (C:\WINNT\cmd.exe ) on Windows XP Profeccional (C:\Windows\cmd.exe ) on Windows XP Home
- Initial folder “$FileDir” the currently opened file’s directory
- Check “Prompt for parameters”
- Check “Save all documents first”
- Check “Capture output”
A simply shortcut could be assigned to this tool (herewith Ctrl + 4 used). So after pressing Ctrl + 4 , a text field for providing the parameters to the cmd.exe appears. Now by typing any command (for example dir /s /b ) textpad will provide the output of the command in the Command Results window, which could be saved instantly to a text file.
Textpad has the powerful feature to search for files (recursively) containing text or even regular expressions from the “Find in Files” or Ctrl + F5, yet sometimes one remembers only part of the filename and would not wait for the long lasting full directory searching by Textpad and would rather browse the names of the files (recursively) and open the result by simply opening it. This could be achieved by configuring textpad to run dos commands (see above)and simply Ctrl + 4 , type:
where /R \\my_network\file_folderToStartSearchFrom\ *stringToSearch*
This would require the Microsoft’s where.exe command line utility.


Other usefull commands might be the help for all dos / *nix gnu commands

for example

Tools - command
set /?

Not not mention ...
With shortcuts (Set first the shortcut )
Ctrl + 4 (or whatever you have set )
type :
perldoc perlfunc

needs perl ; )
Last edited by OnlyTextPad on Thu Apr 12, 2007 1:16 pm, edited 3 times in total.
OnlyTextPad
Posts: 41
Joined: Sat May 20, 2006 9:10 pm
Location: Helsinki
Contact:

Open recursively set of files

Post by OnlyTextPad »

Put the exec.bat into your path
http://www.bristle.com/Tips/Windows.htm ... t_of_files
Now with the "Command liner setting" , Press Ctrl + 4 (this happens to be my shortcut for it :D )
and type

Code: Select all

exec *.pl *.txt /s /b do cmd /c start /max textpad 
there is space after textpad :!:
So this opened all *.txt and *.pl type of files from the current directory and all its subdirectories (the /s switch of the dir command used in exec.bat )

Thanks to Fred Stluka !!!
OnlyTextPad
Posts: 41
Joined: Sat May 20, 2006 9:10 pm
Location: Helsinki
Contact:

I am gettingannoyng but ... How to generate numbers... or ..

Post by OnlyTextPad »

::GENERATE THE NUMBERS FROM 1 TILL 10 000 with the for command and textpad command liner settings

Ctrl+ 4 (or whatever was your one set ) and type :

Code: Select all

@echo off&for /L %n in (1,1,10000) do @echo %n
will get you
1
2
3
4
...
10000

WELL if you want to get the numbers divisible by 7 change the step so :

Code: Select all

@echo off&for /L %n in (0,7,10000) do @echo %n 
will get you :
0
7
14
21
28
35
...
9996


WELL what the ... the for command does ?
Ctrl + 4 type for /? and you will face the worst documented shell on the planet ...
or just simply run this one liner to get allmost all the help needed .... by one liner

Code: Select all

for /f "tokens=1 delims= " %f in ('help') do for /f "delims=" %n in  ("%f") do %n /? 
ben_josephs
Posts: 2456
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

You don't need to use an external program to generate sequence numbers.

In TextPad, create the required number of blank lines. You can do this by recording a scratch macro that creates one blank line, and then replaying it the appropriate number of times (Macros | Multi-play...).

Then put a sequence number on each line:
Find what: ^
Replace with: \i

[X] Regular expression
Look in TextPad's help, under How To... | Find and Replace Text | Generate Sequence Numbers.
OnlyTextPad
Posts: 41
Joined: Sat May 20, 2006 9:10 pm
Location: Helsinki
Contact:

Open often used files from the Start - Run - dialog

Post by OnlyTextPad »

Well this goes already to the Windows Tips and Tricks forums :D

Code: Select all

REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" /v "f" /d "textpad \"C:\Temp\Kikkulas\HTML_CHEATSHEET.html\"\1" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" /v "g" /d "textpad \"C:\Temp\Kikkulas\cmdCheatSheet.cmd\"\1" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" /v "h" /d "textpad \"C:\Temp\Kikkulas\PerlCheatSheat.pl\"\1" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" /v "i" /d "textpad \"C:\Temp\UTILS\exctract.pl\"\1" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" /v "j" /d "textpad \"C:\Documents and Settings\%userName%\Desktop\\Good_Morning.cmd\"\1" /f
REG ADD "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" /v "k" /d "textpad \"C:\temp\regs_and_hacks\\run.cqf\"\1" /f
OnlyTextPad
Posts: 41
Joined: Sat May 20, 2006 9:10 pm
Location: Helsinki
Contact:

Tip obsolete ?!

Post by OnlyTextPad »

With the newest TextPad this tip has gotten obsolete ; )
Post Reply