Guide: Automating Calculator

First, I started Calculator. Then, I used UiSpy to grab the main window, then each of the calculator controls (there are a lot! It was worth it, though). I make no pretense that this is the ‘best’ way to do this, it just works.

Here is a screenshot of my code:

Please be sure to look at this page.

My results appear to differ a little from what’s there:


You can see in my code that AppMask = ‘Calc3AppMask’.
I don’t even have an entry for what would be the ‘Application’, i.e. ‘Calculator’, at all.

As I noted in my code comment, and as it states on the referenced page, you don’t need to use the ‘Screen’ entry at all if there is a single screen. I used the ‘Screen’ entry, i.e. ‘Window_Calculator’, only once, just to verify that it can be omitted.

As you can see, 3 of my 4 selectors use ‘Calc3AppMask3.’, in other words I used ‘AppMask’; I didn’t use ‘Application’ at all; and I both used and did not use ‘Screen’.
The controls for the buttons, of course, are required.

The mathematically astute will not be surprised by this result :grinning: :


Here is a screenshot of part of my UiSpy mask creation.

Note that the name is ‘Calc3AppMask’. My reference to ‘Calc3’ right below it appears not to be needed. ‘Window_Calculator’ here is what would be ‘Window_Main’ on the docs page, and in fact you grab it by clicking:


All the buttons and the text field were added using:


I hope this will be useful.

Best regards,

1 Like

Another great guide @burque505, bravo and thank you!
Keep up the great work! :smiley:

Best regards,

James Papadimitriou
Technical Evangelist

1 Like