我正在使用 AppleScript 创建一个脚本,该脚本将在系统偏好设置中打开“远程登录”,而无需实际打开窗口。
下面是我的代码,它正在工作,但仍然打开“系统偏好设置”窗口,因此我可以确切地看到它在做什么:
tell application "System Preferences" to launch
tell application "System Preferences" to set current pane to pane "com.apple.preferences.sharing"
tell application "System Events" to set visible of process "System Preferences" to false
tell application "System Events" to tell process "System Preferences"
click checkbox 1 of row 5 of table 1 of scroll area 1 of group 1 of window "Sharing"
tell application "System Preferences"
quit
end tell
end tell
我尝试了各种线路,例如:
tell application "System Events" to set visible of process "System Preferences" to false
但它仍然没有给我想要的结果。
我的问题是,有没有我可以写的行可以在执行此过程时隐藏窗口?谢谢。