开发者

Applescript Random Delay

开发者 https://www.devze.com 2023-02-26 19:55 出处:网络
I need to play a sound at random times throughout the day. How can I create a random delay function, tha开发者_StackOverflow社区t then plays the file through the system audio?delay x takes an integer

I need to play a sound at random times throughout the day.

How can I create a random delay function, tha开发者_StackOverflow社区t then plays the file through the system audio?


delay x takes an integer for an argument.

random number from a to b generates a random integer between values a and b


try this

on run {}
    my doit()
end run

on doit()
    display dialog "hello world"
end doit

on idle {}
    set ran to random number from 0 to 10
    doit()
    return ran
end idle

be sure to save it as stay open application

0

精彩评论

暂无评论...
验证码 换一张
取 消