Page 1 of 1

Customproperties

Posted: Tue Jun 08, 2010 9:53 am
by tal
Hi,

I have an object, which has customproperties, if i do this instruction in the messagebox :

Code: Select all

put the customproperties of grp 1 
Why cant I see them? i would like to save this customproperties in a file. Thanks

Re: Customproperties

Posted: Tue Jun 08, 2010 10:42 am
by Klaus
Hi Tal,

you are just using the wrong keyword!

To see the custom properties (two words!) of an object you can:
...
answer the CUSTOMKEYS of btn xyz
# or whatever object you need
...

To get or set a specific custom porperty yôu need to supply the name of the property:
...
put the cMyCustomProperty of fld "field 666"
...
set the cMyCustomProperty of fld "field 666" to "whatever you want to..."
...

So you can loop through the "CUSTOMKEYS" to get the names and values of the custom properties of your object:
(Quick and dirty script! Needs a lot of finetuning, but may get you started!)
...
put the CUSTOMKEYS of btn "my button" into tCK
repeat for each line i in tCK
put i & TAB & the i of btn "my button" after tVariable
end repeat
put tVariable into url("file:myCustomProps.txt")
## This will only work for TEXT in custom porperties, since they can also hold binary data.
## Drop a line if you also want to process binary data!
...

Best

Klaus

Re: Customproperties

Posted: Tue Jun 08, 2010 11:04 am
by tal
Ok thanks, I want to save a grps I have a created on a card of a stack... So i wanted to save their customproperties and then rebuild the groups by script.

But i have seen the instruction

Code: Select all

save this stack as "filename"
, but if i want to load this file saved from a standalone, how can I do?

Maybe with open file, but the file saved has no extension.

Tal

Re: Customproperties

Posted: Tue Jun 08, 2010 12:00 pm
by Klaus
Hi Tal,

is this a substack of your standalone (main-) stack?
Then this will not work and you will have to create a text file for your custom props to store!

Anyway, you can open any valid stack (with or without suffix!):
...
go stack "filename"
...

Best

Klaus


P.S.
Still two (2) words: Custom Property :D

Re: Customproperties

Posted: Tue Jun 08, 2010 1:02 pm
by tal
I have this script in the save button :

Code: Select all


on mouseUp
  
  
  set the mainstack of stack "libBinConvert" to "libBinConvert"
  set the mainstack of stack "toolbox" to "toolbox"
  set the mainstack of stack "Completer les informations" to "Completer les informations"
  set the mainstack of stack "Atelier" to "Atelier"
   
  
  
  save this stack as "test6"
  
  
  set the mainstack of stack "libBinConvert" to "Ergotool_IHM"
  set the mainstack of stack "toolbox" to "Ergotool_IHM"
  set the mainstack of stack "Completer les informations" to "Ergotool_IHM"
  set the mainstack of stack "Atelier" to "Ergotool_IHM"
  
  
  
  
end mouseUp


and this script in the load button :

Code: Select all

on mouseUp
  
  set the mainstack of stack "libBinConvert" to "libBinConvert"
  set the mainstack of stack "toolbox" to "toolbox"
  set the mainstack of stack "Completer les informations" to "Completer les informations"
  set the mainstack of stack "Atelier" to "Atelier"
  
  delete this stack
  
  go stack url("test6")
  
  
  set the mainstack of stack "libBinConvert" to "Ergotool_IHM"
  set the mainstack of stack "toolbox" to "Ergotool_IHM"
  set the mainstack of stack "Completer les informations" to "Ergotool_IHM"
  set the mainstack of stack "Atelier" to "Ergotool_IHM"
  
  
  
end mouseUp


It works, but do you think it will work in a standalone, my mainstack is "Ergotool_IHM", and i only want to save "Ergotool_IHM" without its substacks so I change the mainstack.... thanks.

Re: Customproperties

Posted: Tue Jun 08, 2010 1:34 pm
by Klaus
Hi Tal,

this will definitively NOT work in a standalone, since standalones cannot save themselves!
So whatever you do, the changes will not get saved!
AND you(r user) may not have write permission in the current folder/application folder, too!

Get used to save everything to external files in the users preferences folder, where you have write permission!


Best

Klaus

Re: Customproperties

Posted: Tue Jun 08, 2010 1:56 pm
by tal
Ok, I only want to save the content of a card of my mainstack, is there not an easy way to make that?

I thought to copy my card to an external file and then open it.... if you have any clue, thany you.

Tal

Re: Customproperties

Posted: Tue Jun 08, 2010 2:55 pm
by Klaus
Hi Tal,

hm, what exactly do you want?
1. Save some custom proprerties and read them in again?
2. Save a new or modified card?

#1 was already explained in one of my earlier answers.
# 2 is definitively NOT easy and might make a radical change of your application design neccessary!


Best

Klaus

Re: Customproperties

Posted: Tue Jun 08, 2010 3:43 pm
by tal
I succeed to save a standalone doing like that :

Code: Select all


on mouseUp
  
  lock screen
  
  create invisible stack "Sauvegarde" 
  
  copy cd "vue" of stack "Ergotool_IHM" to stack "Sauvegarde"
  
  set the mainstack of stack "Sauvegarde" to "Sauvegarde"  
  
  save stack "Sauvegarde" as "test17"
  
  delete stack "Sauvegarde"
  
  unlock screen
  
end mouseUp


and then I open the stack I saved and I replace my card.

Thank you

Tal

Re: Customproperties

Posted: Tue Jun 08, 2010 3:56 pm
by Klaus
Hi Tal,

hey, very smart solution!
I am sure I would have made this far more complicated, maybe because I am working for more than 10 years with Rev :D



Best

Klaus