How to feed SQL batchfiles to MySQL as a Tool menu command
Using MySQL from Textpad.
Thanks to Textpad Support for the pointer : Run mysql from a
.BAT file
Setup:
1. Write a batch file (mysql.bat) which contains the one line:
mysql -vvv < %1
Place it anywhere on your PATH - I use C:\
2. In textpad:Configure:Preferences:Tools:Add... Command: c:\mysql.bat
Parameters: $File
Initial Folder: $FileDir
Capture Output ON
3. Write your sql file, but the first line must say which
database to use.
(In another_trial.sql)
use test;
create table noch_try(
jnum int,
jwrd varchar(50)
);
show tables;
4. Run the Tool.
5. Result :
--------------
create table noch_try(
jnum int,
jwrd varchar(50)
)
--------------
Query OK, 0 rows affected (0.00 sec)
--------------
show tables
--------------
+-----------------+
| Tables_in_test |
+-----------------+
| event |
| imptest |
| noch_try |
| pet |
+-----------------+
4 rows in set (0.00 sec)
Of course, thereafter, for any alterations to the table you will
have to write a drop table or something before the CREATE
command.
Putting data into MySQL tables from Textpad
Use:
mysqlimport [options] database textfile1
[Section 14.6 of mySQL Manual gives options]
Configure for MySQL import in
Textpad:Configure:Preferences:Tools:Add...
Command: C:\mysql\bin\mysqlimport.exe
Parameters: --local --fields-terminated-by=^ -v database $File
Directory: $FileDir
Set prompt ON, to edit in the 'database' you are using each time.
Name the base name of your file same as the table you want to
write to :
Example Session ;
1. Create a test table in mysql :
mysql> use test; -- This is the database I am going to make the table in
Database changed
mysql> create table try_it(num int, wrd varchar(50));
Query OK, 0 rows affected (0.00 sec) -- that's the table made.
2. Create your input data in Textpad, and save (UNIX format)
with same basename as the table (So in try_it.txt) 1^This is the first one^
2^A second Entry^
3^My separator is seldom used in text^
4^Note that separator is used also at the end^
5^Because it marks cell termination.^
6^Far handier for inputting data to tables^
7^Also, save in UNIX format for correct^
8^Line endings (Record Termination)^
9^Pretty useful.^
3. Run the Tool from Textpad : (At the prompt set database to
test). Connecting to localhost
Selecting database test
Loading data from LOCAL file: C:/Windows/DESKTOP/try_it.txt into try_it
test.try_it: Records: 9 Deleted: 0 Skipped: 0 Warnings: 9
Disconnecting from localhost
Process completed successfully
4. Check the table back in mysql :
mysql> select * from try_it;
+------+======================================-------+
| num | wrd |
+------+======================================-------+
| 1 | This is the first one |
| 2 | A second Entry |
| 3 | My separator is seldom used in text |
| 4 | Note that separator is used also at the end |
| 5 | Because it marks cell termination. |
| 6 | Far handier for inputting data to tables |
| 7 | Also, save in UNIX format for correct |
| 8 | Line endings (Record Termination) |
| 9 | Pretty useful. |
+------+======================================-------+
9 rows in set (0.00 sec)
This tip was contributed by: John Montgomery
How to Configure Ctags as a tool in TextPad.
Ctags can generate an index table and send it to TextPad's
command results window. You can download Ctags from:
http://darren.hiebert.com/ctags/
In TextPad configure a DOS tool with the following setup:
Parameters: ctags -x -R | grep "^$Sel\>"
Regular Expression: ^[[:alnum:]_]+ +[a-z ]+\([0-9]+\) +\([^
]+\)
File Register = 2
Line Register = 1
Set your initial folder to point to the top of your source
code tree that you wish to search.
Note: for this to work, both ctags and grep must be in your
path. We use the "grep" available when you install the cygwin
toolset. Availble from
http://sources.redhat.com/cygwin/ (you could use MKS tools
as well.) The beauty of the ctags tool is that it supports C,
C++, PERL, Java, Fortran, and many more.
To operate, highlight the keyword you wish to search for,
invoke the tool, and double click on the resulting line in the
command results window.
This tip was contributed by: David Vanden Heuvel,
Software Designer, Zucotto Systems, Inc.
How to utilize Ctags to jump to the definition of any
identifier.
1. Download "Exuberant Ctags" to create the ctags file. Its
available free from: http://ctags.sourceforge.net/
2. Create a ctags file for your software. Use the -n option so
the file will contain line numbers.
3. Compile the C++ program listed at the end of the e-mail. If
you need a C++ compile, DJGPP is free from:
http://www.delorie.com/djgpp/
4. Create a Tools entry for the program:
Command: <enter the name of the C++ program>
Parameters: <ctags file name> $SelWord
Initial Folder: $FileDir
Options Set: Capture Output and Suppress Output Until Complete
Regular Expression: ^.*, (.*), ([0-9]+)
File: 1
Line: 2
5. Now you can just place the carat on the identifier and
execute the tool. When the Output screen appears just
double-click on the entry you wish to jump to.
Notes:
1. The method assumes that the code and the ctags file are in
the same directory. You will have to modify some things if this
is not true.
2. I use POSIX regular expressions. If you don't, then preceed
the open and close parentheses with back slashes.
C++ program to file the ctags file:
// C++ program to dump ever occurrance of a given tag in a tag file
// Usage: <prog> <tag file> <tag>
#include <string>
#include <iostream>
#include <fstream>
#include <cstring>
#include <cctype>
using namespace std;
int main(int argc, char* argv[])
{
// check for correct number of arguments
if (argc != 3)
{
// strip path from progam name
const char* prg = argv[0];
const char* const fslash = strrchr(prg, '/');
const char* const bslash = strrchr(prg, '\\');
if (fslash && bslash)
prg = fslash > bslash ? fslash + 1 : bslash + 1;
else if (fslash)
prg = fslash + 1;
else if (bslash)
prg = bslash + 1;
cerr << "Usage: " << prg << " <tag file> <tag>" << endl;
return -1;
}
ifstream f(argv[1]);
if (!f)
{
cerr << "Failed to open file." << endl;
return -1;
}
string tag(argv[2]), ftag, file, type, tmp;
unsigned line;
while (f && !f.eof())
{
f >> ftag;
if (ftag == tag)
{
f >> file >> line;
getline(f, tmp); // get remainer of line
// look for type infomation
type = "";
int pos = tmp.find(";\"");
if (pos >= 0)
{
// skip whitespace
pos += 2;
while (isspace(tmp[pos]))
++pos;
type = string(", ") + tmp.substr(pos);
}
cout << ftag << ", " << file << ", " << line << type << endl;
}
else
getline(f, tmp); // disgard line
}
return 0;
}
This tip was contributed by: Rich Herrick,
Lockheed-Martin Federal Systems, Owego, NY
TextPad can be used as a great editor for VBScript code.
You can run your VBScript (*.vbs) file from within TextPad by
by creating a new tool.
1. From the "Configure" menu select "Preferences"
2. Select the "Tools" page then.....
Add "Explorer.exe" with $File and $FileDir parameters.
OR
Add "cmd" with $File and $FileDir parameters. Windows NT/2000
users. Win 9x users should use "command".
As long as you have Microsoft Windows Scripting Host (WSH)
installed, you will be able to run your VBScript from within
TextPad.
This tip was contributed by: Peter Gomis, Senior
Developer, Skandia AFS IT - Global Systems Engineering Services,
Shelton, CT
User defined tool settings to allow the user to commit
changes to a CVS repository.
All examples assume that the DOS client is installed on your
machine, and you've checked out the module you're working on.
The WinCVS program includes the dos client programs. These
definitions are not intended to replace the use of WinCVS or DOS
CVS, just make it easier to commit changes from TextPad.
CVS Login
Command: drive:\path\to\cvs\cvs.exe
Parameters: -z9 -d :pserver:user@host:/path/to/cvs/repository login
Initial Folder: $FileDir
Do not capture the output of this command - this is an
interactive command that prompts for your password
CVS Update
Command: drive:\path\to\cvs\cvs.exe
Parameters: -z9 update
Initial Folder: $FileDir
CVS Commit File
Command: drive:\path\to\cvs\cvs.exe
Parameters: -z9 commit -m "" $FileName
Initial Folder: $FileDir
You will need to prompt for parameters here, and insert the
log message between the quotes.
This tip was contributed by: Dave Weiner - Chief
Technology Officer, WebMasters, Inc. - www.webmast.com
Automating the Installation Process
By following the steps described here, you can create a
standard installation, which can be run on each workstation,
without user interaction.
First, record a file containing your setup choices:
- Open the self-extracting executable (e.g. TXPENG41.EXE)
with a ZIP program, such as WinZip.
- Extract all the files to a folder on your server,
preserving the subfolder structure.
- Click Start and Run setup, from the DISK1 subfolder, as
follows:
SETUP.EXE -r
- Do a normal installation, selecting the options you
require.
- This will record your choices in a file called
SETUP.ISS, in your Windows folder. Move SETUP.ISS to the
DISK1 subfolder.
Next, configure TextPad to your requirements, as follows:
- Run TEXTPAD.EXE
- From the Help menu, choose "Enter License Code".
- Enter your license code and click OK.
- From the Configure menu, choose Preferences.
- Make any changes on each page of the Preferences dialog
box and click OK.
- Exit from TextPad.
Now, extract TextPad's settings from the registry:
- Click Start and run REGEDIT.EXE
- Using the Export command on the File menu, export the
following key to HKCU.REG:
HKEY_CURRENT_USER\Software\Helios\TextPad 4
- Export the following key to HKLM.REG:
HKEY_LOCAL_MACHINE\Software\Helios\TextPad 4
- Start TextPad and open HKCU.REG and HKLM.REG.
- Create a new document and copy all of HKLM.REG into it.
- Append all of HKCU.REG to the new document, except its
first line ("REGEDIT4").
- Save it as "TEXTPAD.REG", in the DISK2 subfolder.
Finally, install TextPad on each workstation, by clicking on
start and running setup from the DISK1 subfolder on the server
as follows:
SETUP.EXE -s
Tip to Run Java Programs With an Automatically Closing MSDOS
Window.
Applies to Textpad Version 4.1, running on Windows 98.
Straight after installation, the "Tools | Run Java Application"
menu option does not close the MSDOS window automatically after
you close your Java application.
To add a Tool menu option to do this, follow the steps below:
- Choose the Textpad menu option "Configure |
Preferences".
- Click on "Tools" in the left hand list of the
"Preferences" window.
- Click on the "Add" button and select "Program...".
- In the "File name" text area, type:
c:\windows\command.com and press return.
- Slowly double click on the "Command" text and change it
to: Quick Run Java Application
- Click on the 'OK' button.
- Choose the Textpad menu option "Configure |
Preferences".
- Double click on "Tools" in the left hand list of the
"Preferences" window.
- Click on the "Quick Run Java Application" text in the
left hand list of the "Preferences" window.
- In the parameters field, type: /C java.exe $BaseName
- Uncheck the "Capture output" checkbox.
- Click on the 'OK' button.
When this Tool option is used to run your Java programs, closing
your Java program will automatically close the MSDOS program
too. Unfortunately, any output sent to the MSDOS console is
lost. If you want to keep this output, replace step 11 above
with:
(alternate step)
11. Check both the 'Capture output' and 'Suppress output until
complete' checkboxes.
This tip was contributed by: Jim Burton
Using with MS Visual Sourcesafe 5:
To check the active file in and out of Visual SourceSafe, you
can add commands that run SS.EXE to TextPad's Tools menu. You
will first need to add the following two lines to SS.INI (which
can be found in the folder with your user name in the \VSS\USERS
folder):
Comment_Editor_Prompt = Yes
Comment_Editor = notepad.exe
Do not use TextPad as the comment editor, as SS waits for it to
terminate before completing the command.
To run the commands from a DOS prompt, you would type:
C:\VSS\win32\ss.exe checkin file-name
C:\VSS\win32\ss.exe checkout file-name
The equivalent commands can be added to the TextPad Tools menu
as follows:
- From the Configure menu, choose Preferences.
- Select "Tools" on the Preferences dialog box.
- Click Add and select Program.
- Browse for SS.EXE with the Select File dialog box, and
click Open.
- Click Apply.
- Click the "+" next to Tools, and select "SS".
- Change the Menu Text to Check In.
- Set the Parameters to checkin
$FileName
- Set the Initial Folder to $FileDir.
- Clear all the check boxes, except Capture Output
(optional).
- Click Apply.
Repeat the above steps for the checkout command.
Document Publishing with WS_FTP:
To publish the active document to your web site with WS_FTP, add
a tool to TextPad's Tools menu, with the following settings:
Command: C:\Program Files\WS_FTP\WS_FTP95.EXE
Parameters: -p My-Profile-Name -s local:$FileName
-d My-Profile-Name:/www/htdocs/$FileName
Initial Folder: $FileDir
It took a lot of sweat to get this right, so make sure you only
put spaces in the Parameters line exactly as above, and note
that it's actually a single line. All of the check boxes on the
Tools dialog box should be cleared. Replace
My-Profile-Name with the name of a profile you have
configured in WS_FTP, but note that its title must not contain
any spaces, otherwise it won't work. If necessary, replace
"/www/htdocs" with the path to your files on your web server.
The parameter following "-s" is the source file name, where
"$FileName" gets expanded to the name of the active document,
and the parameter following "-d" is the destination file name,
using WS-FTP's syntax.
This tip was contributed by: Christopher Locke,
Entropy Gradient Reversals, All Noise - All the Time,
http://www.rageboy.com/
(David J. Evans adds: "I've only managed to get this
to work by modifying the remote path to exclude the leading /
.... assuming that the path is a subdirectory from the home
directory then the / should not be needed. The error messages
from WS_FTP are particularly unhelpful !")
Document Publishing with WS_FTP alternative settings:
I tried the tip provided by Christopher Locke on using WS_FTP
with TextPad. His set up somehow does not work for me. Instead I
changed the setting to:
command: E:\Program Files\WS_FTP\WS_FTP95.exe
parameters: -p My-Profile-Name -s Local:$File -d
My-Profile-Name: $UNIXPath/$FileName
initial folder: $FileDir
There are two differences between my setting and Christopher's
setting:
1. with -s Local, I used $File instead of $FileName;
2. I used $UNIXPath instead of hard coding the unix path. I did
this because I mirrored the directory structure of the unix
server on my local machine, this way the $UNIXPath obtained from
local $Path will match the file path on the unix server.
This tip was contributed by: Feng Wu
feng@systechusa.com, Systech Solutions Inc., Glendale, CA, USA.
@-Files:
When working with "@-files", including the name of the "@-file"
in the list makes it easy to add and remove files, each time you
use it.
Thanks to
Ron "Quinn" Straight for this tip.
Print All:
TextPad has is a Print All command, but it's not on a menu. To
use it, you must assign a shortcut to the command as follows:
- From the Configure menu, choose Preferences.
- Select "Keyboard" on the Preferences dialog box.
- From the Categories list, choose File.
- From the Commands list, choose FilePrintAll
- Type the shortcut in the box.
- Click Assign.
- Click Close.
Browse Equivalent Page on Web:
If you maintain your web site on a hard disk mirror that uses
"relative URL addressing" -- that is, the file names in URLs are
just the basic filenames, not fully qualified web addresses --
you can take advantage of the following user tool:
Menu text: Browse equivalent page on web
Command: C:\Program Files\Internet Explorer\Iexplore.exe
Parameters: http://www.MyWebSite.com/$FileName
When you are editing a local copy of a web page, run this
command to see the page on your web site.
This tip was contributed by: Christopher Locke,
Entropy Gradient Reversals, All Noise - All the Time,
http://www.rageboy.com/
Search & Replace; Converting META NAME Elements
Some times you need to transform each META NAME line into
another form. In following example, we take the header
information from a Microsoft Knowledge Base article and convert
it to XML. Note the conversion is not complete, but it is a
start. Be sure to correct "dangling" content. The regular
expression cannot convert elements in which the content is split
across lines.
FIND:
^[^"]+"\([^"]*\)"[^"]*"\([^"]*\)"*.*
REPLACE:
<\1>\2</\1><BR>
CHANGES:
<TITLE>Q10022 - OFF97: EPS File Is Not Printed or Is Printed
Incorrectly Under Windows NT</TITLE>
<META HTTP-EQUIV="CONTENT-Type" CONTENT="text/html;
charset=iso-8859-1" />
<META HTTP-EQUIV="PICS-Label" CONTENT="(PICS-1.1
"http://www.rsac.org/ratingsv01.html" l gen true comment "RSACi
North America Server" by "Inet@microsoft.com" for
"http://support.microsoft.com" on "1998.02.17T12:28-0800" r (n 0
s 0 v 0 l 0))" />
<META NAME="ms.locale" CONTENT="EN-US" />
<META NAME="Category" CONTENT="Support; KB Article" />
<META NAME="Premium" CONTENT="Support" />
<META NAME="KBArea" CONTENT="Support; KB; word97" />
<META NAME="KBID" CONTENT="Q10022" />
<META NAME="KBTitle" CONTENT="OFF97: EPS File Is Not Printed or
Is Printed Incorrectly Under Windows NT" />
<META NAME="Description" CONTENT="When you print an Encapsulated
PostScript (EPS) file, the file may fail to print or may be
printed incorrectly." />
<META NAME="Product" CONTENT="word97" />
<META NAME="KBCreate" CONTENT="April 6, 1984" />
<META NAME="KBModify" CONTENT="April 28, 1999" />
<META NAME="EditDate" CONTENT="January 22, 1999" />
<META NAME="Question" CONTENT="" />
<META NAME="Versions" CONTENT="WINDOWS:97; winnt:4.0" />
<META NAME="Component" CONTENT="" />
<META NAME="Technology" CONTENT="" />
<META NAME="Links" CONTENT="" />
<META NAME="Keywords" CONTENT="kbprint offwin offprint" />
<META NAME="Platform" CONTENT="WINDOWS winnt" />
<META NAME="Hardware" CONTENT="" />
<META NAME="SolutionType" CONTENT="kbfix" />
<META NAME="IssueType" CONTENT="kbbug" />
<META NAME="BoilerPlate" CONTENT="" />
<META NAME="ProducedView" CONTENT="" />
<META NAME="QUERYWORDS" CONTENT="EPS">
<META NAME="QUERYWORDS" CONTENT="filter">
<META NAME="QUERYWORDS" CONTENT="print">
<META NAME="QUERYWORDS" CONTENT="garbled">
<META NAME="QUERYWORDS" CONTENT="does">
<META NAME="QUERYWORDS" CONTENT="not">
<META NAME="QUERYWORDS" CONTENT="is">
<META NAME="QUERYWORDS" CONTENT="printed">
TO:
<TITLE>Q10022 - OFF97: EPS File Is Not Printed or Is Printed
Incorrectly Under Windows NT</TITLE>
<CONTENT-Type>text/html; charset=iso-8859-1</CONTENT-Type>
<PICS-Label>(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l
gen true comment "RSACi North America Server" by
"Inet@microsoft.com" for "http://support.microsoft.com" on
"1998.02.17T12:28-0800" r (n 0 s 0 v 0 l 0))</PICS-Label>
<ms.locale>EN-US</ms.locale>
<Category>Support; KB Article</Category>
<Premium>Support</Premium>
<KBArea>Support; KB; word97</KBArea>
<KBID>Q10022</KBID>
<KBTitle>OFF97: EPS File Is Not Printed or Is Printed
Incorrectly Under Windows NT</KBTitle>
<Description>When you print an Encapsulated PostScript (EPS)
file, the file may fail to</Description>
print or may be printed incorrectly." />
<Product>word97</Product>
<KBCreate>April 6, 1984</KBCreate>
<KBModify>April 28, 1999</KBModify>
<EditDate>January 22, 1999</EditDate>
<Question></Question>
<Versions>WINDOWS:97; winnt:4.0</Versions>
<Component></Component>
<Technology></Technology>
<Links></Links>
<Keywords>kbprint offwin offprint</Keywords>
<Platform>WINDOWS winnt</Platform>
<Hardware></Hardware>
<SolutionType>kbfix</SolutionType>
<IssueType>kbbug</IssueType>
<BoilerPlate></BoilerPlate>
<ProducedView></ProducedView>
<QUERYWORDS>EPS</QUERYWORDS>
<QUERYWORDS>filter</QUERYWORDS>
<QUERYWORDS>print</QUERYWORDS>
<QUERYWORDS>garbled</QUERYWORDS>
<QUERYWORDS>does</QUERYWORDS>
<QUERYWORDS>not</QUERYWORDS>
<QUERYWORDS>is</QUERYWORDS>
<QUERYWORDS>printed</QUERYWORDS>
This tip was contributed by: Anthony Missico,
Jr., Independent Consultant, Missico Information Systems,
www.missico.com
Extra tip for "How can I make Notepad use TextPad instead of
WordPad for big files?"
Users of TextPad v4.x who have read the Help Menu/FAQ and
executed the tip under "How can I make Notepad use TextPad
instead of Wordpad for big files", will now find that
TextPad is called to open Windows Write files (files with .wri
extension) and may find this unwieldy due to them being binary
files and TextPad will therefore show them in HEX format.
If you would STILL PREFER for WORDPAD to open Windows Write
files giving "plain text" presentation, this can be achieved by:
In Windows Explorer:
- Go to C:\Program Files\Accessories\ and select
WordPad.exe. Copy + Paste to make "Copy of WordPad.exe" and
RENAME to WordPad1.exe.
- On the View menu Folder Options\File Types, select Write
Document and EDIT, revise program used to perform Open,
Print & Printto Actions from WordPad.exe to WordPad1.exe
each case.
- Go to C:\Windows\Start Menu\Accessories\WordPad.exe link
and on the Edit menu Properties revise the "Target" from
WordPad.exe to WordPad1.exe.
This I have found to be the best all-round combination of
Windows and TextPad v4.x
This tip was contributed by: Dave Rudd, AMIEE
How to use the thumb buttons on Microsoft's IntelliMouse
Explorer:
The small and large thumb buttons on this mouse generate the
same messages as using Alt+Right arrow and Alt+Left arrow
respectively. Hence, you can assign them to, for example,
TextPad's Page Up/Down commands as follows:
- From the Configure menu, choose Preferences.
- Select "Keyboard".
- In the list of Categories, choose "Cursor".
- In the list of commands, choose "PageUp".
- In the shortcut box, hold down the Alt key and press the
right arrow key.
- Click Assign.
- In the list of commands, choose "PageDown".
- In the shortcut box, hold down the Alt key and press the
left arrow key.
- Click Assign.
- Click OK
How to Compile Java Applications that have environment
variables set:
Suppose you are wanting to use servlets and the oracle database,
and compile your java application using Textpad. You may end up
having your command line so long that it becomes hard to manage,
so you want to set some environment variables to store the jar
files you will be using, and the classpath. Using the normal
javac that TextPad sets up will not be able to find these
environment variables, so you need to do the following:
If you have the following information in your c:\autoexec.bat
SET PATH=%PATH%;c:\oracle\ora81\bin;c:\java\jdk12~1.2\bin;c:\java\classes
SET CLASSPATH=c:\java\classes
SET JARFILES=c:\java\classes\servlet.jar;c:\java\classes\oracle.jar
- In TextPad select the Configure menu click on
Preferences.
- Select the Tools page.
- Click on the Add button and select "Dos Command".
- Paste the following line into the box:
javac -classpath %JARFILES%;%CLASSPATH% -d c:\java\classes $File
(Note: -d tells javac where you want to output the generated class files.)
- Click OK.
In the Settings for this, you should setup the following
information:
| Command: |
COMMAND.COM |
| Parameters: |
javac -classpath %JARFILES%;%CLASSPATH% -d
c:\java\classes $File |
| Initial Folder: |
$FileDir |
| Capture Output : |
checked |
| Sound Alert When Completed: |
checked |
| Regular Expression: |
^\(\(\(\\\\[^\]+\\[^\]+\)\|\([A-Za-z]:\)\)[^:]+\):\([0-9]+\): |
| Registers: |
File=1, Line=4 |
This tip was contributed by: Garth Fielding
TextPad and LaTeX
The main goal while editing LaTeX source is of course to make
the edit-compile-view-edit cycle as quick as possible.
To achieve this, we have to set up all the involved tools.
TextPad (to launch the TeX compiler and the DVI viewer), the TeX
compiler (so that we can jump directly to a reported error with
typing "e") and the DVI viewer (so that double clicking in the
document will jump to this paragraph in TextPad).
I illustrate the necessary settings with the TeX distribution
MiKTeX because that is the one I have. This should work with
other distributions as well. You just have to find the right
place for the settings.
Working with LaTeX
As TextPad is not specially designed for LaTeX, we have to
work in a certain way to get all the advantages of our settings.
First you have to decide what you normally do in LaTeX. Do
you have a main file that includes several other files? Or do
you have single-file LaTeX "projects".
I describe here how to set up TextPad for working with a main
file that includes other files. If you work with single files,
you have to change the settings accordingly.
The reason for this is, that we can give the current file or
the current workspace name to our tool. If we do the first, we
have to switch to the main file of our project to invoke the TeX
compiler. Awkward if you have several files open.
So the working principle is to create a TextPad workspace for
each LaTeX project that has the same basename as the main file
of the LaTeX project. By that we can be in any file of the
project and always compile the main file. Another solution would
be to use always the same name for the main file (like
main.tex).
As I have the german TextPad the translations of edit-field
labels are more of a general guideline :-)
TextPad
Switch off "Allow Multiple Instances"! Otherwise jumping from
the DVI viewer to TextPad will open a new instance of TextPad
which will then not work because the workspace is not present.
Create 2 new tools:
TeX compiler as a DOS command:
Parameter: texify --src $WspBaseName.tex
Initial directory: $WspDir
Saving all files would be a good idea, don't capture the
output (!) and close the window after execution if you want.
--src inserts source specials that allow inverse search.
For single-file LaTeX projects just replace the workspace by
the file (so use $FileName and $FileDir instead of
$WspBaseName.tex and $WspDir).
The DVI viewer as a program:
Program: yap.exe
Parameter: -1 -s $Line$FileName $WspBaseName.dvi
Initial directory: $WspDir
Insert your favorite DVI viewer instead of yap.
-1 tells yap to reuse an open instance
-s tells yap to make a forward search. This even works for files
that are not the main file. yap will open at the location of the
cursor in the current file.
For single file LaTeX projects use $BaseName and $FileDir
instead of $WspBaseName and $WspDir.
DVI-Viewer (yap)
Under "View", "Options...", "Inverse Search", "Command line"
insert
textpad "%f"(%l)
This will invoke TextPad when you double click in a document
you view.
TeX
If TeX encounters an error, it prompts you on the screen and
you can press "e" to edit the file. Which editor is invoked is
set in the INI file of MiKTeX and other TeX distributions should
have a similar setting somewhere.
Create a new file (mymiktex.ini) and put
[TeX]
Editor=textpad "%f"(%l)
in it. Then call
initexmf --personal=mymiktex.ini
Then typing "e" will invoke Textpad instead of notepad.
Umlauts and accents
There is no need for a macro that replaces all the Umlauts or
accented characters to the TeX representation (ä -> "a) if you
use the inputenc-package
usepackage[ansinew]{inputenc}
in the preambel of your LaTeX file. Then you may use all
characters that you can type in, I think. I only tried it with
the german Umlauts and the accents ´,` and ^.
Example
This is it! Everything is set up so use TextPad as follows:
- Create a new TeX-file, e.g. "FirstTest.tex".
- Save a new workspace. This gets the name "FirstTest.tws"
anyway, so you don't even have to retype the name.
- Edit your file "FirstTest.tex".
- Run the texify tool to create the DVI file.
- If there are errors, you can correct them by typing "e".
- Run the yap tool to view the result. yap will jump to
the paragraph the cursor is currently in.
- Double clicking somewhere in yap will jump to the
corresponding paragraph in TextPad.
This tip was contributed by: Jens Hollmann. 12
October 2001.
Regular expression for the free Pascal compiler:
- Expression = ^\([^(]+\)(\([0-9]+\),\([0-9]+\)
- File Register = 1
- Line Register = 2
- Column Register = 3
This tip was contributed by: Carl Eric Codere. 15
December 2003.
Regular expression for CCSC's PICC C-Compiler for Microchip
PICs:
- Expression =
^[^"]+"\([^"]+\)[^0-9]+\([0-9]+\)(\([0-9]+\)
- File Register = 1
- Line Register = 2
- Column Register = 3