diff --git a/scripts/auto_repairs.py b/scripts/auto_repairs.py index 7e0fd1f5..00c5fa14 100644 --- a/scripts/auto_repairs.py +++ b/scripts/auto_repairs.py @@ -51,6 +51,7 @@ BASE_MENUS = { MenuEntry('CHKDSK', 'auto_chkdsk'), MenuEntry('DISM RestoreHealth', 'auto_dism'), MenuEntry('SFC Scan', 'auto_sfc'), + MenuEntry('Fix File Associations', 'auto_fix_file_associations'), MenuEntry('Clear Proxy Settings', 'auto_reset_proxy'), MenuEntry('Disable Pending Renames', 'auto_disable_pending_renames'), MenuEntry('Registry Repairs', 'auto_repair_registry'), diff --git a/scripts/wk/repairs/win.py b/scripts/wk/repairs/win.py index c21c4c3f..0b7d7174 100644 --- a/scripts/wk/repairs/win.py +++ b/scripts/wk/repairs/win.py @@ -20,7 +20,13 @@ from wk.exe import ( wait_for_procs, ) from wk.io import delete_folder, rename_item -from wk.kit.tools import ARCH, download_tool, get_tool_path, run_tool +from wk.kit.tools import ( + ARCH, + download_tool, + extract_tool, + get_tool_path, + run_tool, + ) from wk.log import format_log_path, update_log_path from wk.os.win import ( reg_delete_value, @@ -647,6 +653,14 @@ def auto_enable_regback(group, name): save_settings(group, name, result=result) +def auto_fix_file_associations(group, name): + """Run Fix File Associations scan.""" + result = TRY_PRINT.run( + 'Fix File Associations...', fix_file_associations, msg_good='DONE', + ) + save_settings(group, name, result=result) + + def auto_hitmanpro(group, name): """Run HitmanPro scan.""" result = TRY_PRINT.run('HitmanPro...', run_hitmanpro, msg_good='DONE') @@ -791,6 +805,20 @@ def delete_registry_null_keys(): run_tool('RegDelNull', 'RegDelNull', '-s', '-y', cbin=True) +def fix_file_associations(): + """Fix file associations via registry edits.""" + extract_tool('WinAIORepair') + winaio_path = get_tool_path('WinAIORepair', 'Repair_Windows').parent + winaio_path = winaio_path.joinpath( + f'Files/regfiles/file_associations/{platform.win32_ver()[0]}', + ) + for item in winaio_path.iterdir(): + if item.suffix.lower() != '.reg': + continue + cmd = ['reg', 'import', str(item), f'/reg:{ARCH}'] + proc = run_program(cmd, check=False) + + def run_adwcleaner(): """Run AdwCleaner.""" run_tool('AdwCleaner', 'AdwCleaner', download=True)