MD5 digest of arrays and controls
Terry Judd
tsj at unimelb.edu.au
Mon Aug 1 19:20:04 EDT 2011
On 02/08/2011, at 03:57 AM, Alejandro Tejada wrote:
Hi Terry
Terry Judd wrote:
How could I get the MD5digest of an Array and
all the properties of a control?
I guess you could use arrayEncode() first and then get an MD5digest of the
data.
This command works great.
Many Thanks! :-D
Terry Judd wrote:
For example, I created a control, by script,
and I want to make sure that it's identical
to another control created by a different script.
How about copying the objects to the clipboard and then querying the
clipboardData["objects"].
I am not sure how I could use this code
to compare the properties of two controls.
How about comparing the properties arrays of the two controls
In the following example I simply created two identical buttons on a blank stack. They should be identical in almost every respect, the exceptions being their ids their rects and their layers. If you put the properties array of each object into separate variables and delete the elements for those three properties from each variable then the two variables should be equivalent.
on compareProps
put the properties of btn 1 into t1
put the properties of btn 2 into t2
delete variable t1["id"]
delete variable t2["id"]
delete variable t1["rect"]
delete variable t2["rect"]
delete variable t1["layer"]
delete variable t2["layer"]
put t1 = t2
end compareProps
Alternatively, you could simply iterate through the keys of the properties of the two objects and compare the values of the individual properties.
Terry...
Thanks again for your help!
Al
--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/MD5-digest-of-arrays-and-controls-tp3708824p3710396.html
Sent from the Revolution - User mailing list archive at Nabble.com<http://Nabble.com>.
_______________________________________________
use-livecode mailing list
use-livecode at lists.runrev.com<mailto:use-livecode at lists.runrev.com>
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list