How to force a true TXT extension?

Chipp Walters chipp at
Wed Nov 23 23:07:14 EST 2005


I keep as part of one of my libraries a function:


on mouseUp
   ask file "Save As:" with filter "TXT,*.txt"
   if it is not empty then
       put it into tfile
       put fixExt(tfile,"txt") into tfile
       SaveFile #do save stuff here
   end if
end mouseUp

function fixExt pFilePath,pExtension
   local tFileName
   set itemDel to "/"
   put last item of pFilePath into tFileName
   delete last item of pFilePath
   set itemDel to "."
   if the last item of tFileName <> pExtension then
     put pExtension into item (the number of items of tFileName+1) of 
   end if
   return pFilePath & "/" & tFileName
end libFileManagement_FixExtension

William de Smet wrote:

> How can I force a true .TXT extension (even when deleting the  suggested 
> name)?

More information about the Use-livecode mailing list