Hi All.
Have a question, as I don’t understand why this code works:
var preferencesSettings as FolderItem = SpecialFolder.Documents.Child (“screensaverPreferences.txt”)
'var createThePreferencesFile as TextOutputStream
var writeToThePreferencesFile as TextOutputStream
// check if the file exists
if preferencesSettings.Exists = FALSE then // the file DOESN'T exist?
// for testing only
MessageBox "I will create the TEXTFILE for the movies now. It is called: screensaverPreferencet.txt”
// now create the txt file in the folder theMovies
writeToThePreferencesFile = TextOutputStream.Create(preferencesSettings)
writeToThePreferencesFile.Close
writeToThePreferencesFile = TextOutputStream.Open(preferencesSettings)
writeToThePreferencesFile.WriteLine (windowMyMovieScreenSaver.popupMenuStartTimeForScreensaver.SelectedRowText)
writeToThePreferencesFile.WriteLine (windowMyMovieScreenSaver.popupmenuEndTimeForScreenSaver.SelectedRowText)
writeToThePreferencesFile.WriteLine (windowMyMovieScreenSaver.labelVolumeSettingLevel.text)
writeToThePreferencesFile.close
else
// it does exist, we will read it in
MessageBox "The preferences file screensaverPreferences.txt exists”
writeToThePreferencesFile = TextOutputStream.Create(preferencesSettings)
writeToThePreferencesFile.close
writeToThePreferencesFile = TextOutputStream.Open(preferencesSettings)
writeToThePreferencesFile.WriteLine (windowMyMovieScreenSaver.popupMenuStartTimeForScreensaver.SelectedRowText)
writeToThePreferencesFile.WriteLine (windowMyMovieScreenSaver.popupmenuEndTimeForScreenSaver.SelectedRowText)
writeToThePreferencesFile.WriteLine (windowMyMovieScreenSaver.labelVolumeSettingLevel.text)
writeToThePreferencesFile.close
end if
If in the section of the if statement where there is NO file, and I create it, and in the section of the code where the file exists and I need to recreate it, if I do NOT do a writeToThePreferencesFile.close and then writeToThePreferencesFile = TextOutputStream.Open(preferenceSettings.txt) the file is created I get an error 0
Why?
Is there a better way to do this?
Regards