Page 1 of 1

LC: revpreferences

Posted: Wed Nov 24, 2021 12:42 pm
by richmond62
I want to list all the custom properties in the stack "revpreferences" and wonder
why:

Code: Select all

on mouseUp
   repeat for each element PLOP in customProperties of stack "revpreferences"
      put PLOP and return after fld "fPREFFS" of stack "ElsiePreffs"
      end repeat
end mouseUp
gives me this:

"falsefalsefalsefalsefalsefalsefalsefalse" and so on:

1. No returns?

2. "false" ?

Re: LC: revpreferences

Posted: Wed Nov 24, 2021 12:56 pm
by Klaus
Yep, same here!? Must be a bug, if you step through that loop in the debugger PLOP shows the correct value.

Re: LC: revpreferences

Posted: Wed Nov 24, 2021 3:06 pm
by bn
Klaus wrote:
Wed Nov 24, 2021 12:56 pm
Yep, same here!? Must be a bug, if you step through that loop in the debugger PLOP shows the correct value.
But the bug is here
put PLOP and return after fld "fPREFFS" of stack "ElsiePreffs"
"and" is a boolean operator and not a concatenator.

That is why it is returning false, false, etc.

Watch out for arrays in the custom properties.

Try this code: (arrays marked but not resolved)

Code: Select all

on mouseUp
   put the customProperties of stack "revpreferences" into tProps
   put empty into field "fPREFFS"
   repeat for each key aKey in tProps
      put tProps[aKey] into PLOP
      if PLOP is an array then 
         put aKey && "is an Array" & return after tCollect 
         next repeat
      end if
      put aKey & ":" && PLOP & return after tCollect
   end repeat
   put tCollect into fld "fPREFFS" of stack "ElsiePreffs"
end mouseUp

Kind regards
Bernd

Re: LC: revpreferences

Posted: Wed Nov 24, 2021 3:09 pm
by Klaus
AND! Go figure, never thought of THAT!
Obviously my mind translated this to & automatically... 8-)

Re: LC: revpreferences

Posted: Wed Nov 24, 2021 4:00 pm
by richmond62

Code: Select all

on mouseUp
   put empty into fld "fPREFFS"
   repeat for each element PLOP in customProperties of stack "revpreferences"
      put PLOP & return after fld "fPREFFS" of stack "ElsiePreffs"
   end repeat
end mouseUp
AND: "Holy Cow":
-
SShot 2021-11-24 at 16.58.30.png
-
Ever so slightly opaque. 8)