def create_shortcut(self): selected = self.combo.get() if not selected: return uri = SETTINGS_URIS[selected] desktop = Path(os.path.expanduser("~/Desktop")) shortcut_path = desktop / f"selected.lnk"
Content = "⚙️ Settings", Width = 120, Height = 40, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center ; button.Click += async (s, e) => open settings shortcut windows 11
# Opens Windows 11 Settings Start-Process ms-settings: – Save as SettingsShortcut.ahk : def create_shortcut(self): selected = self
self.root.mainloop()
ps_script = f''' $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut("shortcut_path") $Shortcut.TargetPath = "explorer.exe" $Shortcut.Arguments = "shell:::uri" $Shortcut.Save() ''' subprocess.run(["powershell", "-Command", ps_script], capture_output=True) tk.messagebox.showinfo("Success", f"Shortcut created at shortcut_path") Width = 120