我的 Electron 应用程序中有页面,我可以在其中显示可以记录的打开应用程序
apps page
我使用 DescktopCapturer.getSources() 方法获得的这些应用程序并在那里显示屏幕的 ID 和图标。
我想在选择其中一个后将它们显示在桌面顶部,例如我选择 Chrome 并且我需要使用 Electron 打开 chrome,我该怎么做?谢谢!)
最佳答案
我找到了我的问题的答案。
tell application "System Events" to tell process "${appName}"
set frontmost to true
windows where title contains "${name}"
if result is not {} then perform action "AXRaise" of item 1 of result
end tell
如果您不需要按标题过滤,您可以这样做tell application "System Events" to tell process "${appName}"
set frontmost to true
perform action "AXRaise" of item 1 of result
end tell
关于node.js - 如何使用 Electron 在桌面上打开外部应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65989124/