Page 1 of 1

Use textpad as a command liner

Posted: Thu Nov 02, 2006 1:43 pm
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 ; )

Open recursively set of files

Posted: Thu Feb 15, 2007 6:44 am
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 !!!

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

Posted: Sat Feb 24, 2007 7:41 pm
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 /? 

Posted: Sun Feb 25, 2007 3:47 pm
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.

Open often used files from the Start - Run - dialog

Posted: Thu Mar 15, 2007 9:33 am
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

Tip obsolete ?!

Posted: Sat May 05, 2007 7:04 pm
by OnlyTextPad
With the newest TextPad this tip has gotten obsolete ; )