From d6ff994fe715eda1ace59ae72f9494fc6e388c80 Mon Sep 17 00:00:00 2001 From: LexiconCode Date: Sun, 28 Feb 2021 20:49:05 -0600 Subject: [PATCH] Error handling for restore_window --- castervoice/lib/utilities.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/castervoice/lib/utilities.py b/castervoice/lib/utilities.py index 11b8e7a95..c8c4a1a99 100644 --- a/castervoice/lib/utilities.py +++ b/castervoice/lib/utilities.py @@ -85,8 +85,14 @@ def minimize_window(): Window.get_foreground().minimize() def restore_window(): + ''' + Restores last minimized window triggered minimize_window. + ''' global lasthandle - Window.restore(lasthandle) + if lasthandle is None: + printer.out("No previous window minimized by voice") + else: + Window.restore(lasthandle) def get_active_window_info(): '''Returns foreground window executable_file, executable_path, title, handle, classname'''