我的任务是部署几台iMac用于公共显示。
他们需要始终运行一个应用程序(Serato DJ),并且在空闲时他们应该显示循环视频 - 使用保存好莱坞屏幕保护程序循环播放多个视频文件
我一直在为这项工作玩弄苹果脚本 - 我会在启动时运行脚本。我认为它应该看起来像这样
苹果脚本 -
tell application "Serato DJ"to activate
on idle
tell application "Serato DJ" to quit
tell application "System Events" to start current screen saver
end idle
我必须退出应用程序,因为它不允许屏幕保护程序启动 - 很像 vlc
我知道这没什么可说的。
有人可以帮我指出正确的方向吗
任何帮助将不胜感激
丹尼尔
好吧,我不确定这个问题是否仍然与您相关,但如果是,这应该有效:
repeat
--This variable is how long the script waits before it turns the screen saver on
set timeToSleep to 300
--
set idleTime to do shell script "ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print $NF/1000000000; exit}'"
considering numeric strings
if idleTime is greater than timeToSleep then
tell application "Serato DJ" to quit
tell application "System Events" to start current screen saver
end if
if idleTime is less than timeToSleep then
if application "Serato DJ" is not running then
try
do shell script "killall ScreenSaverEngine"
tell application "Serato DJ" to activate
end try
end if
end if
end considering
delay 1
end repeat