Reputation:
I need to play a sound at random times throughout the day.
How can I create a random delay function, that then plays the file through the system audio?
Upvotes: 1
Views: 1563
Reputation: 818
delay x takes an integer for an argument.
random number from a to b generates a random integer between values a and b
Upvotes: 3
Reputation: 17640
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
Upvotes: 0