![]() ![]() Note that some applications only allow one instance/process, so you can't get multiple separate windows for each virtual desktop (e.g. The time.sleep() calls are needed because Windows doesn't change virtual desktops instantly (presumably because of animations), and to give the processes time to create windows. Launch_apps_to_virtual_desktops(command_lines) "C:\Program Files\Mozilla Firefox\firefox.exe" "C:\Program Files (x86)\Adobe\Acrobat Reader DC\Reader\AcroRd32.exe" "C:\StudyGuide.pdf" "C:\Program Files (x86)\Google\Chrome Beta\Application\chrome.exe" Virtual_desktop_accessor.GoToDesktopNumber(0) # Go back to the 1st desktop Time.sleep(2) # Wait for apps to open their windows Subprocess.Popen(shlex.split(command_line)) Time.sleep(0.25) # Wait for the desktop to switch Virtual_desktop_accessor.GoToDesktopNumber(i) ![]() Virtual_desktop_accessor = ctypes.WinDLL("VirtualDesktopAccessor.dll") import ctypes, time, shlex, subprocessÄef launch_apps_to_virtual_desktops(command_lines, desktops=3): Put the dll in the current working directory. ![]() VirtualDesktopAccessor.dll by Jari Pennanen exports the functions a part of the mostly undocumented (by Microsoft) Virtual Desktop API. Tested with 64-bit Windows 10 Version 3.720. This can be achieved by launching your applications with subprocess.Popen(), then changing virtual desktop by calling GoToDesktopNumber() from VirtualDesktopAccessor.dll with the help of ctypes, and launching your applications again. How do I tell python to launch an app but in Desktop 2 and 3? ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |