Seems like they patched it straight after your post…
That stuff went all a bit over my head since I wasn’t able to test it… I can certainly see the use for the async case, and that’d be great since the only way to run async actions is to manually click the buttons.
But then when you started adding delays, what are (were) the advantages of it over a simple RunActions?
The main advantage of using nested buttons (at least for me) was the ability to create more complex user interface. So that you can either click the big button for one action, or one of the smaller ones on it for a different one.
I found a solution of how to get rid of the popup and render the actual control object, not a control object wrapped in an object. You still provide it wrapped to ParseJson(), but then use _Deref_Object() to extract the control object:
Regarding nice ways to prevent document crashing when using undocumented functions:
I thought I would attempt to come up with highly convenient way to prevent a crash, by first checking in the current year was prior to 1970 using Today().Year(), and if so, skip the offending code. In principle this works by simply changing the current year on your host O/S… however, I then discovered that Coda servers did not like this technique when dealing with offline documents as presumably it messes up some authentication or sync stuff.
So, I came up with using the current user’s time zone (via CurrentTimezone().CurrentOffset which works brilliantly.
Basically, my usual timezone offset is 0 or 1. So, before I execute any undocumented function, I check the timezone offset. If it’s > 1, then I skip the function. This way, I can simply modify the timezone on my host machine, open the doc and fix the error.
An alternative to this would be to create an artificial user (say ‘Debugger’) and check if the current user = Debugger. If so, skip the offending code.
The real crux of the problem is that if you use an unofficial function, you could crash your doc and end up in a perpetual state of never being about to fix it because it crashes when you open it.
The workaround is to ONLY execute the unofficial function under specific conditions, or to NOT execute them if a certain condition exists e.g based on the current user.
So you need an if() as a minimum at every instance of the hidden formula? Maybe declare a canvas variable with a short name and then if(x,code,"") - that the idea?
@Filmos Does this still work? I cannot get anything to work with the _Color( using the “kr-XXXXX”) format. I can get color to work with basic, “Red”, “Green”, “Blue”, etc. but all the rest of this with the -fg -bg, even if I copy, paste these formulas exactly, I cannot get anything but an error. Am I doing something wrong, or did this function change and make this no longer function?