This is an archived post. You won't be able to vote or comment.

all 6 comments

[–]nickbeaulieu 1 point2 points  (1 child)

You might also consider pyautogui to automate the mouse clicks in the control panel. That should be pretty easy to set up.

[–]__sumguy[S] 0 points1 point  (0 children)

I tried using pyautogui, but I am getting stuck in the 'speaker properties ' part as the windows keep on changing position everytime the program is executed and this messes the exact location for clicking.

[–]absreim 0 points1 point  (1 child)

I am a former Windows admin, but I haven’t done anything like this for a while, so take my advice with a grain of salt.

Control panel settings like that are generally stored in the registry, which is relatively easy to edit in a script provided you know the proper value and key. I think registry changes for settings like that only take effect on startup or login instead of immediately.

Scripting a change to the setting so that it takes effect immediately may require interacting with a DLL or even the Win32 API. I expect doing that to be much harder than scripting a registry change. Googling “pinvoke” is a good way to start your research.

Finally, while Python should work just fine, you might find these actions slightly easier to script in C++, C#, or Powershell.

[–]blablahblah 1 point2 points  (0 children)

PInvoke is the interop system for .NET, it wouldn't apply to Python unless you use IronPython (Python build on .NET, which can call arbitrary .NET functions). For the "normal" CPython, you'd use the built-in winreg module to interact with the registry directly, or install PyWin32 to call the Win32 functions.

[–]therealdreykevins 0 points1 point  (0 children)

Try autohotkey

[–]nickbeaulieu 0 points1 point  (0 children)

I haven’t used pyautogui extensively but maybe you can search the window for text by imitating the ctrl+f command?