Skip to content

Commit

Permalink
v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Illustar0 committed Nov 12, 2024
1 parent 36859b3 commit 00d4287
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
33 changes: 33 additions & 0 deletions PowerToysRunEnhance.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import uiautomation as automation
import comtypes
import os
import string
from pynput import keyboard
import pyautogui

alphabet = list(string.ascii_lowercase)


def on_press(key):
try:
if key.char.lower() in alphabet:
comtypes.CoInitialize()
window = automation.WindowControl(Name="搜索", className="Windows.UI.Core.CoreWindow", searchDepth=2)
if window.Exists(0, 0):
RichEditBox = window.EditControl(AutomationId="SearchTextBox", className="RichEditBox")
ValuePattern = RichEditBox.GetPattern(automation.PatternId.ValuePattern)
if ValuePattern is None:
value = ''
else:
value = ValuePattern.Value
os.kill(window.ProcessId, 9)
pyautogui.hotkey("alt", "space")
pyautogui.typewrite(value)

comtypes.CoUninitialize()
except AttributeError:
pass


with keyboard.Listener(on_press=on_press) as listener:
listener.join()
17 changes: 17 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# PowerToys Run Enhance

PowerToys Run Enhance is a small tool that non-invasively replaces Windows Search with PowerToys Run.

## Function

- Replaces Windows Search (with some bugs)

## How to use

1. Download the pre-compiled file from [Releases](https://github.com/Illustar0/PowerToysRunEnhance/releases):

2. Run it!

## Licence
MIT licence

0 comments on commit 00d4287

Please sign in to comment.