I've tried adding delays and using WaitWindow but I still get the error. I even get the error in the debugger when stepping through if I stay in the Call Stack tab, I have to actually switch to the Locals tab and view the objects in order to get by the errors.
On the machines experiencing the problem.... are you running TestComplete as a local admin? If not.... give that a try.
Alex, Marsha, Robert, thank you for helping!
Hi @StevenN , did you have any luck with running TestComplete as a local admin like tristaanogre suggests? Or, mayhaps, you found any other way to solve this? Thanks.
Just a wild guess:
> w = p["Window"]("#32770", "Font");
The case might be related to populating dialog controls with data. It looks that when the dialog is opened, it populates itself with the list of installed fonts, their styles and pitches and renders the Font list with font samples. These actions take time and it might be that while the Font window already exists and can be referenced in code, it is still not initialized completely and thus the search for the Edit controls fails.
Somewhere in time, in order to resolve this and related problems, I did a loop in my test code for the required control and waited until the number of items in the list box stop to increase.
(E.g. Sys.Process("notepad").Window("#32770", "Font", 1).Window("ComboBox", "", 1).Window("ComboLBox", "", 1).wItemCount)
You may consider how suitable the above sounds for your case.
If none of the suggestions help, I recommend that you refer this question to the Support Team - they may need to investigate the issue in the test lab. You can reach out to them here:
Thanks for all the suggestions, have now contacted support and will post an update if they can find out what is causing the issue.
I agree with @tristaanogre
If you can step through the code and it works, but running it causes the object to not be recognized properly, it's a timing issue. There are several ways you can adjust the timing of the test, both within the code and in the settings, so let us know if you want help with that.