Is there a way I can persist variable values inside of qcad?
Eg. I want to display a dialogue, that asks some values, and on a subsequent run starts with the previously entered values instead of its builtin defaults.
I know I can write those to a file, but would rather not go this way.
--
peter
Persist variable values between script runs
Moderator: andrew
- hungerburg
- Premier Member
- Posts: 160
- Joined: Fri May 28, 2010 7:35 pm
- hungerburg
- Premier Member
- Posts: 160
- Joined: Fri May 28, 2010 7:35 pm
persist data with json
I noticed too, so I write my object as a json string by printf(), as the builtin interpreter does not like json2.js from crockford's json.org.
reading back with "JSON = F.read(); try { preset = eval("(" + JSON + ")"); }" is OK too.
One problem: the windows version of qcad does not read UTF-8. So only plain ascii will transfer correctly between windows and linux versions. I guess there is no utf-8 locale for windows xp, so I will have to live with mangled umlauts until qcad3 comes around.
reading back with "JSON = F.read(); try { preset = eval("(" + JSON + ")"); }" is OK too.
One problem: the windows version of qcad does not read UTF-8. So only plain ascii will transfer correctly between windows and linux versions. I guess there is no utf-8 locale for windows xp, so I will have to live with mangled umlauts until qcad3 comes around.