[futurebasic] [FB] FIles$ Navigation Services

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : November 2005 : Group Archive : Group : All Groups

From: Brian Stevens <brilor@...>
Date: Thu, 10 Nov 2005 19:38:14 -0700
I'm hoping someone has been through this already because after  
looking in Alain's code and elsewhere (including Apple's docs on Nav  
services), I don't see anything that fits my need (although the  
answer is probably in the Nav Services reference but I was hoping to  
avoid that is possible).

The following fn works just fine except for one little problem. If  
the user chooses a file name that already exists (which is a  
perfectly acceptable option because the program checks and appends  
the file in that case), the current runtime/TB code presents the  
dialog saying the file exists and do they want to replace it. Of  
course, it doesn't get replaced but the dialog will undoubtedly be  
confusing (or annoying for those who figure it out). My question is  
probably obvious to those reading this far:  How do I convince FILES$/ 
nav services to not present the replace dialog or to present one that  
more accurately portrays the status?

TIA----Brian S.


local fn SaveTimerLog
dim as str63     y,  logName, fileName
dim as str255    logDate
dim as FSSpec   fs

def open "TEXTttxt"
y = str$(usr Year) : fn ltrim(y)'get 4 digit year and trim off  
leading space put there by STR$
logName = "Timer Log for" + str$(usr day) + "-" + fn GetMonthName$ 
(Usr month) + "-" + y
logDate = "Timer Log Created" + str$(usr day) + "-" + fn GetMonthName$ 
(Usr month)  + "-" + y
fileName = FILES$(_FSSpecSave,"Pick a NAME and LOCATION for Timer Log  
File",logName,fs)
long if fileName[0]
long if usr FSFileExists(fs)
open "A",1,@fs
xelse
open "O",1,@fs
print #1, logdate 'print header only the first time
end if
print #1, string$(len(logdate),"-")
print #1, "Project name: "  ; fn ButtonTextString$(_TimeLogName)
print #1, "Log Started on: "; fn FormatSecsAsDate$ (gTimerLongStartSecs)
print #1, "Log Stopped on: "; fn FormatSecsAsDate$ (gTimerLongEndSecs)
print #1, "Elapsed Time  : "; fn GetStrElapsedTime$
close #1
end if
end fn