[TxMt] Please help with Project title $TM_ variable

Charilaos Skiadas skiadas at hanover.edu
Thu Jan 25 22:04:24 UTC 2007


On Jan 25, 2007, at 1:41 PM, Web Revolution wrote:
>
> In the 'Template' 'Command(s)' editor I have:
>
> if [[ ! -f "$TM_NEW_FILE" ]]; then
>    TM_YEAR=`date +%Y` \
>    TM_DATE=`date +%d" "%b" "%Y" "@" "%I:%M" "%p" "%z` \
>    TM_USERNAME=`niutil -readprop / /users/\$USER realname` \
>    perl -pe 's/\$\{([^}]*)\}/$ENV{$1}/g' \
>       < testfile.html > "$TM_NEW_FILE"
> fi
>
Ok, add somewhere there, before the perl line, the lines:

NOEXTENSION=${TM_PROJECT_FILEPATH%.tmproj}
JUSTFILENAME=${NOEXTENSION##*/}
then in the template file' editor put:
> and in the 'Template File' editor I have:
>
> <!-- ${TM_PROJECT_FILEPATH} - ${TM_DATE} -->
>
<!-- ${JUSTFILENAME} - ${TM_DATE} -->
>
> Next... I do create a new Textmate project and I save it to desktop  
> as 'testfile' and create a new template, selecting the new template  
> I just created above.
>
> The output for the new created template is:
> /Users/webrevol/Desktop/testfile.tmproj
>
> ..but what I would like to get is only the project filename:
> testfile (or testfile.tmproj)
>
> As you see I would like to get the textmate project name on my new  
> created file without the Path and if possible, without the filename  
> extension.
>
> Again, thanks for your time.
>

Haris





More information about the textmate mailing list