On 5 May 2005, at 20:00, Derek Bump wrote:

Would someone be so kind and please analyze the following script to tell me why it will only write the data to the Preferences file just once, and every time afterward it will not write anything?


on setPref prefName,prefData
put prefData into preferencesData[prefName]
put the keys of preferencesData into theKeys
repeat with x=1 to the number of lines in theKeys
put line x of theKeys & "=" & preferencesData[(line x of theKeys)] &cr after newData
end repeat
put newData into url ("file:Preferences.dat")
end setPref



A couple of points.

Is preferencesData declared as a global (or local) variable somewhere? (e.g. at the top of the script.) If not, the data won't persist and the array will only contain a single element (the one just added) when you get to the repeat loop?

You should check "the result" after the Put ... into url line. This will tell you if an error occurred.

Ex.

   put newData into url ("file:Preferences.dat")
   if the result is not empty then
      answer the result
   end if

Dave

_______________________________________________
use-revolution mailing list
[email protected]
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to