gpt4 book ai didi

javascript - 如何使用 AppleScript 以编程方式关闭仪表板?

转载 作者:行者123 更新时间:2023-11-30 18:06:16 26 4
gpt4 key购买 nike

我正在开发一个小型仪表板小部件,允许用户打开系统偏好面板。

打开首选项面板没有问题(但看起来很糟糕 :p)

widget.system('osascript ' +
'-e \'tell app "system preferences" to activate\'' +
'-e \'<snip…> open correct pane\'')

问题是即使首选项 Pane 打开,仪表板也会保持打开状态。

我找到了打开它的方法:

tell app "Dashboard" to launch

但无法关闭它,close 引发异常并且quit 什么都不做:/

有人知道怎么做吗?

最佳答案

尝试:

tell application "Dashboard" to launch
delay 3
tell application "Finder" to activate

或者可能是击键...

tell application "System Events" to key code 53

关于javascript - 如何使用 AppleScript 以编程方式关闭仪表板?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15744065/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com