Macos iMac在使用时用于公共显示锁定信息亭应用程序,在空闲时用于视频循环

Macos iMac在使用时用于公共显示锁定信息亭应用程序,在空闲时用于视频循环,macos,applescript,launch,idle-timer,Macos,Applescript,Launch,Idle Timer,我的任务是部署多个iMac用于公共显示 他们将需要有一个应用程序在任何时候运行(Serato DJ),空闲时,他们应该显示一个循环的视频-使用saveHollywood屏幕保护程序来循环和播放多个视频文件 我一直在玩弄applescript来完成这项工作——我会让脚本在启动时运行。 我想应该是这样的 苹果书- tell application "Serato DJ"to activate on idle tell application "Serato DJ" to quit tell app

我的任务是部署多个iMac用于公共显示

他们将需要有一个应用程序在任何时候运行(Serato DJ),空闲时,他们应该显示一个循环的视频-使用saveHollywood屏幕保护程序来循环和播放多个视频文件

我一直在玩弄applescript来完成这项工作——我会让脚本在启动时运行。 我想应该是这样的

苹果书-

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

你把什么定义为空闲?e、 g,当5分钟内没有人互动时?