On Jun 18, 2006, at 10:44 AM, John Jobe wrote:

What is the best way to alter a save file name before the file is actually committed to disk? I'm using GetSaveFolderItem to get the filename/location from the user and seem to only be able to alter the filename using folderItem.name after the file is saved. On Mac OS X at least the file, when saved to the desktop, appears for a second with the original file name as specified by the user then disappears and reappears with the new name but of course only if a file doesn't already exist with the new name. Would prefer to have the standard "would you like to replace the existing file" message and none of the appearing, disappearing, and reappearing stuff if possible.

This is basically what I am using right now... (working in RB2006r2 OS X)

  myFolderItem=GetSaveFolderItem(FileTypes1.TEXT,"")
  if myFolderItem <>Nil then
    myTextOutputStream= myFolderItem.CreateTextFile
    myTextOutputStream.Write(stringOfData)
    myTextOutputStream.close
    tempString= myFolderItem.name
    tempString =right(tempString,4)
    if tempString <>".aaa" then
      myFolderItem.name= myFolderItem.name+".spl"
    end if
  else
        return
  end if

Why not do the name changing BEFORE you create the file:

myFolderItem=GetSaveFolderItem(FileTypes1.TEXT,"")
  if myFolderItem <>Nil then
// do the name catch here
        tempString= myFolderItem.name
    tempString =right(tempString,4)
    if tempString <>".aaa" then
      myFolderItem.name= myFolderItem.name+".spl"
    end if
// --------------------
    myTextOutputStream= myFolderItem.CreateTextFile
    myTextOutputStream.Write(stringOfData)
    myTextOutputStream.close

  else
        return
  end if



Roger M. Clary
Class One Software
http://www.classonesoftware.com
[EMAIL PROTECTED]

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to