0

特定のポートをリッスンするアップルスクリプトを作成しました。「開始」を受信すると、コンピュータは Web カメラからの録画を開始し、「停止」を受信すると録画を停止します。

問題は、常にこのアプリケーションを強制終了しなければならないことです。繰り返し発言のせい?これを回避する方法はありますか?アイドル ハンドラーについて何か読みましたが、アプリケーションが (ユーザーがクリックすることなく) 実行し続けることが重要です。

set recording to 0
repeat
set test to (do shell script "nc -l 2700") as string

if test = "start" and recording = 0 then
    tell application "QuickTime Player"
        activate
        new movie recording
        document "Movie Recording" start
        set recording to 1
        delay 2
    end tell
else if test = "stop" and recording = 1 then
    tell application "QuickTime Player"
        document "Movie Recording" stop
        set pad to path to desktop folder as string
        set naam to (do shell script "date +%s") as integer
        set extension to ".mov"
        set all to pad & naam & extension
        export document "Untitled" in file all using settings preset "720p"
        delay 1
        close document "Untitled" saving no
        set recording to 0
    end tell
end if
end repeat
4

1 に答える 1