How Can I Insert the Simple File Name Into a Document?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
dpherson
Posts: 1
Joined: Tue Oct 13, 2009 9:06 pm

How Can I Insert the Simple File Name Into a Document?

Post by dpherson »

In text pad, I see a command that allows the user to easily insert the fully qualified filename into a document. Is there a command for inserting just the simple file name into the current document. I need to do this for file headers, but see no easy way to do this.
User avatar
Bob Hansen
Posts: 1516
Joined: Sun Mar 02, 2003 8:15 pm
Location: Salem, NH
Contact:

Post by Bob Hansen »

Create a macro toboth insert the full name, and then use a RegEx to reduce it to the basic name.
Hope this was helpful.............good luck,
Bob
User avatar
talleyrand
Posts: 624
Joined: Mon Jul 21, 2003 6:56 pm
Location: Kansas City, MO, USA
Contact:

Post by talleyrand »

As an uglier hack, you can create a DOS batch script, c:\header.bat
Contents would be

Code: Select all

echo %1 >> %2
Set that as a tool
tool parameters of $FileName $File

Usage would be create new file, run tool. If TP doesn't prompt you that the file has changed, give focus to a different document and when focus returns to original, then TP will figure out the file changed.

This only appends the data to an existing file so if there's 1000 lines, it will add to the bottom. A more clever batch script would rename the existing file, dump the one line from TP into correct file, append the existing content to correct file and purge the renamed file. I'm too lazy to have tested that but the point was the tool parameters might be something you can work with.
I choose to fight with a sack of angry cats.
Post Reply