Hi Simon,
What do you mean "erase the file extension"? I have tried the impfile X-Function to import .txt file and found that the extension .txt would add to the Long Name. Do you mean that you do not want the extension appears in the Long Name? If so, you can use the following script to trim the extension.
string strLN$ = page.longname$;
int nLen = Len(strLN$);
string strNoEx$ = Left(strLN$, nLen-4)$;
page.longname$ = strNoEx$;
If not, please provide more details on what you want.
Penn