blu*_*sky 1 macos applescript osx-snow-leopard
我正在尝试自动关闭我的mac,我已经尝试了节能的预定关机,我想睡觉,但这些似乎不起作用.VLC播放器runnign似乎阻止了关机.我想我需要一个脚本来强行关闭mac,而不管运行的各种程序可能会抛出什么错误.
谢谢
好,
这是我用来关闭may的mac的代码.我已将它添加为每晚运行的iCal事件.
tell application "System Events" to set the visible of every process to true
set white_list to {"Finder"}
try
tell application "Finder"
set process_list to the name of every process whose visible is true
end tell
repeat with i from 1 to (number of items in process_list)
set this_process to item i of the process_list
if this_process is not in white_list then
do shell script "killall \"" & this_process & "\""
end if
end repeat
on error
tell the current application to display dialog "An error has occurred!" & return & "This script will now quit" buttons {"Quit"} default button 1 with icon 0
end try
tell application "System Events"
shut down
end tell
Run Code Online (Sandbox Code Playgroud)
你能试试一个简单的AppleScript,就像这样......
tell application "System Events"
shut down
end tell
Run Code Online (Sandbox Code Playgroud)
查看它是否有效,然后您可以在特定时间使其通过Automator运行等.
| 归档时间: |
|
| 查看次数: |
23697 次 |
| 最近记录: |