Notifications
Clear all
[Closed] Execute string command?
Oct 10, 2014 12:38 am
When I select any object and put “showProperties $” I have a list of properties, I load those properties as strings into the listBox and then I would like to let user select one property and execute something like $.that_property = undefined (for example) where “that_property” is only string. Any ideas how to do it?
example:
try(destroyDialog raypro) catch()
rollout test1 "test"
(
listbox lbx
button loadbut "LoadProperties"
fn getPropToArr obj =
(
cp = StringStream ""
showProperties (obj) to:cp
sstr = cp as string
arrayp = #()
str = ""
for i in 1 to sstr.count do
(
c = sstr[i]
if c != "
" then
str += sstr[i]
else
(
append arrayp str
str = ""
)
)
return arrayp
)
local arr = #()
on loadbut pressed do
(
arr = getPropToArr $
lbx.items = (for o in arr collect o as string)
)
)
createdialog test1 width:400 height:200
2 Replies
Oct 10, 2014 12:38 am
it’s a little different but you can use getpropnames and getproperty. it might be good enough for your task
Oct 10, 2014 12:38 am
Thanks again Denis, setProperty did the job, it was exactly what I was looking for