From 9e2656c8ef53cf5db4562c291d49bb767abffef8 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 12fbcf81a..766f7ce5f 100644 --- a/castervoice/lib/utilities.py +++ b/castervoice/lib/utilities.py @@ -84,8 +84,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'''