Perhaps you want to use setdictionaryvalue instead of appenddictionaryvalue. It will add a new entry or replace an existing value if it finds a matching key.
Dumpdictionary always outputs the dictionary with a = sign between the key and the value.
Appenddictionaryvalue will modify an existing dictionary value if it finds the key. It does this by adding the value to the dictionary and inserting the separator. As you found, if it does not find the key, it creates a new key/value pair, and inserts the separator at the front of the value. And you can change the = sign with the replace( function. Here is an example:
appenddictionaryvalue aDict, "myKey",",","myValue2"
alertsheet replace(DumpDictionary(aDict),"="," is ")
I just learned something new. I did not realize that you could leave off the parameters to this function to create an empty dictionary. As an programmer with experience in other languages, I can see why you would think that, and you were right! This is not documented, and I don’t know if I ever intended this or tested it. But it works.
By the way, there is another way to make an empty dictionary:
This is leftover from Panorama 6, where dictionaries were implemented as text with special tags in them. Now dictionaries are opaque binary values, but Panorama X does have a special case that allows it to recognize "" as an empty dictionary. But using initializedictionary() is just as good, maybe better since it is more clear what the intent is.
You do, but that kind of sucks. Starting with the b33 release, you won’t need to do that anymore, you can just append, append, append. Here’s the code change I just committed.
mdj, I thought you had deleted it too. I started writing my reply but when I tried to post it, it did not work and then I could not find your original. After a while, and I don’t know what I did, it came back and there was your original and my reply. In the meantime, the color of your entire entry changed to a peach color; I guess now that means it had been deleted. Anyway, it was not a waste of time, because I learned in the process exactly the difference between setdictionaryvalue and appenddictionaryvalue.