Napkin Math script is now passing 100% of the time


Back in April, I was having a problem investigating a failing automation script.  The script was a napkin math script (napkin math is the lingo we  use for the feature in OneNote that computes simple equations as you enter them).  The failure had nothing to do with the feature in OneNote.  It only failed in the code that was typing on the screen.


I updated the script with extra logging to track exactly what the script was doing.  After adding the logging, the script is back at a 100% successful passing rate.  Normally this would worry me.  I did not change the nature of the test - it still types equations such as  "cos(75)-cos(30)*cos(45)-sin(-30)*sin(45)=" to compute the result of the equation.  I had suspected, among other problems that could have caused this intermittent problem, that a timing problem could be the source of the instability.


The only two things that the script now does after adding my logging is execute the logging command and then write the information to the log file on the drive.  This could explain the new results I see.  The timing may have been subtly altered to slow down the typing just enough to allow the napkin math to evaluate the expression correctly.


Unfortunately, I can only guess that this is the root of the problem.  It seems like a reasonable guess, but I can't be sure since I never could track the original problem.  And since I have actually altered my test now to enable me to troubleshoot, I'm in an observer effect paradox in some ways.  I suspected timing was a problem and had to change the timing to validate my assumption.  Now I don't want to get into quantum level problems with napkin math automation since I have much more other work to complete, so I will just leave it as it is.


I should also point out that it works in many languages - Spanish, French, German, Chinese and so on.  I'm definitely going to leave it alone.


Oh, and there is one Spanish test unique to that language I want to share.  Try this with OneNote:  type "phi=" and hit enter.  I've mentioned this before - you get the "Golden Ratio" constant from the ancient Greek world.  When I added that test to my automation, it failed in Spanish because in that language you need to type "fi=" to get the same result.


I don't like automation that is this dependent on the UI, but in this case I really don't have a choice and need to adjust for it.  That is also the only language I could find that made this change.


Questions, comments, concerns and criticisms always welcome,




Comments (0)

Skip to main content