Home › Forums › General XMetaL Discussion › size limit of DocumentProperty › Reply To: size limit of DocumentProperty
Reply to: size limit of DocumentProperty
July 13, 2010 at 11:13 pmAll I can say at this point is that in theory there should be no limit. How big is your string?
A quick stress test in XMetaL Author 6.0 shows that a million characters is not an issue. It might take quite a while to build the string (the pure JScript looping part).
[code]// XMetaL Script Language JScript:
var curDoc, curDocProps;
curDoc=Application.ActiveDocument;
curDocProps=curDoc.CustomDocumentProperties;
bigStr = “”;
for (i=0;i<100000;i++) {
bigStr += “1234567890”;
}
Application.Alert(“bigstr.length = ” + bigStr.length);
curDocProps.Add(“cdpropsBigStr”, bigStr);
var s = curDocProps.item(“cdpropsBigStr”).value;
Application.Alert(“cdpropsBigStr.length = ” + s.length);[/code]
If you increase the number of iterations (or increase the string that is being added) you can easily test bigger values. Note that this is a very inefficient way to build a string in JScript so it will take exponentially longer the more times you iterate through, but it is an easy way to stress the system. So, if you have a large text file on disk you might use Application.FileToString to read it in instead.