Thanks so much Charles. It works fine!
I put this code in the calling routine :
------------------------------------------------------------------------
dim theSettingsFolder as FolderItem
theSettingsFolder = GetSettingsFolder()
if theSettingsFolder <> nil then
//_____ CREATE FILE __________________
dlg.InitialDirectory = theSettingsFolder
dlg.promptText="Enter a filename"
dlg.SuggestedFileName="Data Export" + d.shortdate + ".txt"
dlg.Title="Save exported class data as "
f=dlg.ShowModal()
If f <> Nil then
t = f.createtextFile
.....................
t.close
And this (your method) :
------------------------------------------------------------------------------
-
Function GetSettingsFolder
dim appFolder as FolderItem
dim theSettingsFolder as FolderItem
appFolder = GetFolderItem("")
If appFolder Is Nil or NOT appFolder.Exists then //something really odd
has happened
Return Nil
End if
theSettingsFolder = appFolder.Child("Settings")
If theSettingsFolder Is Nil then //you may have a permissions problem
Return Nil
End if
If theSettingsFolder.Exists then
If theSettingsFolder.Directory then
Return theSettingsFolder
Else //you could handle this case differently; for instance, you might
want to alert the user
Return Nil
End if
Else //if it doesn't exist, then try to create it
theSettingsFolder.CreateAsFolder
Return theSettingsFolder
End if
_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>
|