-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprogram_exe.py
More file actions
73 lines (62 loc) · 2.26 KB
/
program_exe.py
File metadata and controls
73 lines (62 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import pyautogui
import time
import winreg
import os
def open_via_start(search_text):
"""Open an application via Windows Start menu - supports Turkish characters"""
try:
import pyperclip
pyautogui.press('win')
time.sleep(0.5)
# Use clipboard for Turkish characters
pyperclip.copy(search_text)
time.sleep(0.2)
pyautogui.hotkey('ctrl', 'v')
time.sleep(5.0)
pyautogui.press('enter')
time.sleep(0.5)
return f"{search_text} başlatıldı."
except Exception as e:
print(f"❌ Start menu error: {e}")
return f"Hata: {e}"
def open_program(program_name):
"""Open the specified program"""
try:
result = open_via_start(program_name)
print(f"✅ {result}")
return True
except Exception as e:
print(f"❌ Program open error: {e}")
return False
def get_installed_programs():
"""List installed programs on the computer"""
programs = []
reg_paths = [
r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
r"SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall",
]
for reg_path in reg_paths:
for root in (winreg.HKEY_LOCAL_MACHINE, winreg.HKEY_CURRENT_USER):
try:
reg_key = winreg.OpenKey(root, reg_path)
for i in range(0, winreg.QueryInfoKey(reg_key)[0]):
try:
subkey_name = winreg.EnumKey(reg_key, i)
subkey = winreg.OpenKey(reg_key, subkey_name)
try:
name, _ = winreg.QueryValueEx(subkey, "DisplayName")
if name and len(name) > 0:
programs.append(name)
except (FileNotFoundError, OSError):
pass
except (FileNotFoundError, OSError):
pass
except (FileNotFoundError, OSError):
pass
return sorted(set(programs))
def list_desktop_files():
desktop_path = os.path.join(os.path.expanduser("~"), "OneDrive\\Masaüstü")
files = []
for item in os.listdir(desktop_path):
files.append(item)
return files