Skip to content

Windows

Windows module for autopylot.This module contains functions that are specific to Windows.

Examples:

>>> from autopylot import windows
>>> windows.show_desktop()
>>> windows.get_active_window()
'Notepad'
>>> windows.get_all_opened_window_titles()
['Notepad', 'Program Manager', 'Desktop']
>>> windows.maximize_window(window_name='Notepad')
>>> windows.minimize_window(window_name='Notepad')
>>> windows.close_window(window_name='Notepad')
>>> windows.launch_app(path='Notepad')

The module contains the following functions:

  • show_desktop(): Show the desktop.
  • get_active_window(): Get the active window.
  • activate_window(window_name)- activate a window.
  • get_all_opened_window_titles(): Get all opened windows.
  • maximize_window(window_name): Maximize a window.
  • minimize_window(window_name): Minimize a window.
  • close_window(window_name): Close a window.
  • launch_app(path): Launch any windows application by its path or name.

activate_window(window_name)

Activate window

Parameters:

Name Type Description Default
window_name str

Window title

required

Returns:

Type Description
None

None

Examples:

>>> windows.activate_window(window_name='Notepad')

close_window(window_name)

Closes the window

Parameters:

Name Type Description Default
window_name str

Window name

required

Returns:

Type Description
None

None

Examples:

>>> windows.close_window(window_name='Notepad')

get_active_window()

Get active window

Returns:

Name Type Description
Window str

Active window

Examples:

>>> windows.get_active_window()

get_all_opened_window_titles()

Get all opened titles windows

Returns:

Name Type Description
titles str || list

All opened titles windows

Examples:

>>> windows.get_all_opened_window_titles()

launch_app(path)

Launch any exe/bat application

Parameters:

Name Type Description Default
path str || WindowsPath

Path to exe/bat application or application name

required

Returns:

Type Description
None

None

Raises:

Type Description
FileNotFoundError

If path is not found

ValueError

If path is empty

Examples:

>>> windows.launch_app(path=notepad)

maximize_window(window_name)

Maximize windows

Parameters:

Name Type Description Default
window_name str

Window name.

required

Returns:

Type Description
None

None

Examples:

>>> windows.maximize_window()

minimize_window(window_name)

Minimize windows

Parameters:

Name Type Description Default
window_name str

Window name

required

Returns:

Type Description
None

None

Examples:

>>> windows.minimize_window(window_name='Notepad')

show_desktop()

Minimize all windows and show the desktop.

Returns:

Type Description
None

None

Examples:

>>> windows.show_desktop()