>I have a question or possible feature request.  In the application I 
>am working on, users can create files to save data to.  I check to 
>make sure, when a user enters a new file name to be created, that the 
>file does not already exist.  Since I always append a suffix to the 
>file name if the user has neglected to do this, I cannot rely on the 
>standard replace query feature in the file save dialog box to catch 
>duplicate file names (since, if the user didn't append the suffix, 
>the file name used would be different from the one that the standard 
>dialog would check for).

Unless I misunderstand you, try something like

ask file "Save as..."
if it is empty then exit to metaCard

# Handle suffix
set the itemDel to "/"
put item 1 to -2 of it into tPath
put last item of it into tFile
set the itemDel to "."
if num of items of tFile>1 then
  if last item of tFile is not <suffix> then
    put <suffix> into last item of tFile
  end if
else put <suffix> into item 2 of tFile

# Recombine file path
put tPath&"/"&tFile into tFilePath

if there is a file tFilePath then
  answer warning "A file with this name already exists. Do you want to
replace it?" with "No" or "Yes"

/H

Hugh Senior

The Flexible Learning Company
Consultant Programming & Software Solutions
Fax/Voice: +44 (0)1483.27 87 27
Email: [EMAIL PROTECTED]
Web: www.flexibleLearning.com

Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to