I made the same mistake a while ago, until I remembered that the encoded array is binary. You have to write and read it to/from a binary file. If you just use "open file" you get text only.

--
Jacqueline Landman Gay | jac...@hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
On March 18, 2022 6:40:40 PM Bob Sneidar via use-livecode <use-livecode@lists.runrev.com> wrote:

Hi all.

I'm running 9.6.7 rc2. I have this code in a closeStackRequest handler:

  put the settings of me into tSettingsA
  put field "fldEAFilePath" into tSettingsA ["eafilepath"]
  put field "fldInvFilePath" into tSettingsA ["invfilepath"]
  put field "fldOutFilePath" into tSettingsA ["Outfilepath"]
  put the dgText [true] of group "dgVariance" into tSettingsA ["gridtext"]
  put arrayEncode(tSettingsA) into tSettingsText
  put the filename of this stack into tSettingsPath
  set the itemDelimiter to "/"
  put "settings.prefs" into item -1 of tSettingsPath
  open file tSettingsPath for write
  write tSettingsText to file tSettingsPath
  close file tSettingsPath

Then in the openStack handler I have this:

  put the filename of this stack into tSettingsPath
  set the itemDelimiter to "/"
  put "settings.prefs" into item -1 of tSettingsPath
  open file tSettingsPath for read
  read from file tSettingsPath until eof
  put it after tSettingsText
  close file tSettingsPath
  put arrayDecode(tSettingsText) into tSettingsA
  set the settings of me to tSettingsA

Instead of an array, I get the text "gr" which is the first 2 characters of the key "grid text" in the array. That can't be right!

Bob S


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode




_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to