8000 Get win version from windows.Desktop class by OvidiuCode · Pull Request #5 · robocorp/example-windows-notepad · GitHub
[go: up one dir, main page]

Skip to content

Get win version from windows.Desktop class #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion conda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ dependencies:
- robocorp-truststore=0.8.0 # https://pypi.org/project/robocorp-truststore/
- pip=23.2.1 # https://pip.pypa.io/en/stable/news
- pip:
- robocorp==1.4.3 # https://pypi.org/project/robocorp
- robocorp==1.6.2 # https://pypi.org/project/robocorp
- robocorp-windows==1.0.1 # https://pypi.org/project/robocorp-browser
16 changes: 1 addition & 15 deletions tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,6 @@
FONT_SIZE = os.getenv("NOTEPAD_FONT_SIZE", "12")


def get_win_version() -> str:
"""Windows only utility which returns the current Windows major version."""
# Windows terminal `ver` command is bugged, until that's fixed, check by build
# number. (the same applies for `platform.version()`)
WINDOWS_10_VERSION = "10"
WINDOWS_11_BUILD = 22000
version_parts = platform.version().split(".")
major = version_parts[0]
if major == WINDOWS_10_VERSION and int(version_parts[2]) >= WINDOWS_11_BUILD:
major = "11"

return major


@setup
def open_close_notepad(task):
"""Opens Notepad for automation, then closes it at the end."""
Expand All @@ -52,7 +38,7 @@ def _select_property(unique_id: str, value: str):


def change_font_settings(family: str, style: str, size: str):
ver = get_win_version() # slightly different automation based on Windows version
ver = desktop.get_win_version() # slightly different automation based on Windows version

# Opens the Edit menu and goes into Font.
if ver == "11":
Expand Down
0