Page 1 of 1
How Can I Insert the Simple File Name Into a Document?
Posted: Tue Oct 13, 2009 9:11 pm
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.
Posted: Wed Oct 14, 2009 1:22 am
by Bob Hansen
Create a macro toboth insert the full name, and then use a RegEx to reduce it to the basic name.
Posted: Thu Oct 15, 2009 6:17 pm
by talleyrand
As an uglier hack, you can create a DOS batch script, c:\header.bat
Contents would be
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.