I have a script that creates a form with several fields. I want to save the contents of these fields in design, and the next time when I open the design and launches the script I have already configured the form.
There are functions for including the file or string to .brd-file, there are functions for working with the properties of the design...
What is the best way to save my settings?
Maybe someone has an example code?
I woud look at using Skill's disembodied property list and the save the list in the database as an attachment (see axlSetAttachment).
On read you can eval the attachment return (axlGetAttachment) which will give you free parsing and the disembodied prop list gives you some future profing if you need to latter on you need to extend what you are storing.
It does not work. axlCreateAttachment () does not accept the list. It is necessary to print the list to a string?
You need to convert the disem prop list to a string and pass it as the argument t_data. Also s_dataFormat needs to be set to a value of 'string, To convert a disembodied prop list to a string just do:
dataString = sprintf(nil " '%L" myDisembodyPropStruct)
while it might be hard to see the single quote (') immediately before the %L is important for "Get" part of the process.
To convert back from a string do:
str = axlGetAttachment(... 'string)
myDisembodyPropStruct = errsetstring(str)
Thanks. It works.
Do you think this is a good solution for storing these data in design file? Or it may be better to save them in a separate file? Why?
For a better understanding of the issue: we are talking about additional editing tool for aligning objects on the board. The default tools are stored individual settings for each design (probably in the design).But would not it be negative consequences if I save my data in the design? Maybe in the next version of the editor, this feature will be unavailable or even break down the design? Or perhaps these data will be conflict with other programs?Does anyone have an opinion on this issue? How do you keep your variables, in the design or in a separate file?