Jump to content
Sam Jones

GetSavedSetting and Dynarray of Char

Recommended Posts


   A simple test script would give you your answer. I happen to have one here:

	category = 'DummyCatAGory';
	setting = 'SomeSetting';
	valueIN, valueOUT :Dynarray of Char;
	S :String;
	valueIN := '/F1 /Helvetica ff [-144 72 div 0 0 144 72 div 0 0] mf def 
/F2 /Helvetica ff [-20 72 div 0 0 20 72 div 0 0] mf def 
/F3 /Helvetica ff 144 72 div scf def 
/F4 /Helvetica ff 20 72 div scf def 
/F5 /Helvetica ff 28 72 div scf def 
/F6 /Helvetica ff [-28 72 div 0 0 28 72 div 0 0] mf def 
/F7 /Helvetica ff 16 72 div scf def 
/F8 /Helvetica-Bold ff 24 72 div scf def 
/F9 /Helvetica ff 36 72 div scf def 
/F10 /Helvetica ff 96 72 div scf def';

	SetSavedSetting(category, setting, valueIN);
	if GetSavedSetting(category, setting, S) then
	else message('Nope');


Now what you need to explain is why this script works.


1) When I declare "valueOUT" as a Dynarray of Char the complier kicks an error with GetSavedSetting(), saying valueOUT is not the correct variable type.

2) When I substitute string "S" for the return variable "valueOUT", which GetSavedSetting() DOES accept, not only does the script compile (as I expect it to), but it runs and returns all 437 characters in string "S", much more than a STRING's allotted 255 characters is supposed to handle. 


So, to answer your questions, YES, SetSavedSetting() WILL accept a DynArray; and NO, GetSavedSetting() WILL NOT accept a DynArray. But who cares since the latter call works with a STRING.


——— Caveat, this script was only run in VW 2019. Your mileage may vary in earlier VW versions. ———






Share this post

Link to post

I think with some changes to support Unicode in Vectorscript with 2019 the limitation of strings being 255 characters was eliminated. If you are using older versions you will still be limited to 255 characters for a string.

Share this post

Link to post

Kevin beat me to it.  Raymond your test needs to include a test with a dynarray of char that is longer than 255 characters.  I have code that I want to bridge 2018 and 2019, so I'm not sure what I'm going to do.

Thanks all.


Share this post

Link to post

Thank you,@klinzey.

   I vaguely remember something being mentioned to that effect, but details and dates tend to blur the longer I do this. I started back in 1990 with MC+2.0. There's a lot of blur piling up. Yes, I see the difference now. Very nice to know. Thanks for mentioning it. 


@Sam Jones,

    If you count the number of characters in the Dynarray in my example you'll see why I said, "but it runs and returns all 437 characters in string "S",". In another test I tried it with a text block twice that amount to see if there was a 512 limit, but it worked with 874 characters. The Devil's in the Details.


   You can store Dynarrays in a record field, but that's local to file. With a little bit of work you could split your DynArray into 255-char-bite-sized-chunks and store each piece in the SavedSettings library. Some reassembly is required. Or, you could write your data to a file if all else fails. 




Share this post

Link to post

My bad.  I looked at the wrong number in the BBEdit footer.  It looks like VW2019 is going to be fine, but 2018 will not.  I can write to a file, but I was hoping not to.  Splitting the string up is doable, but that sort of thing always bites me in the ass down the road.


Thanks all



Share this post

Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114


© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

  • Create New...