Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --settings
- property alertVolume : 50 -- percentage
- property outputVolume : 50 -- percentage
- property alarmRepeatInterval : 5 -- seconds
- property alarmText : "alarm!"
- property alarmCount : 5
- global firstrun
- tell me to activate
- set firstrun to true
- set alarmText to userString()
- set alarmCount to userNumber()
- on idle
- try
- --get firstrun
- if firstrun is false then
- my alarm()
- else
- set firstrun to false
- end if
- on error m number n
- tell me
- beep
- activate
- display dialog (n as text) & return & (m as text)
- tell me to quit
- end tell
- end try
- return alarmCount * 60
- end idle
- on userString()
- set theString to text returned of (display dialog "Enter the text you want displayed for this alarm" default answer alarmText)
- return theString
- end userString
- on userNumber()
- try
- set theNumber to (text returned of (display dialog "enter the number of minutes after which you want to be alarmed" default answer alarmCount)) as number
- on error number -1700
- display dialog "you may only enter numbers"
- getalaramTime()
- end try
- return theNumber
- end userNumber
- on alarm()
- set {prevAlertV, prevOutputV, prevOutputM} to {alert volume, output volume, output muted} of (get volume settings) -- cache current volume settings
- set volume alert volume alertVolume
- set volume output volume outputVolume
- set volume without output muted
- set theConfirmation to ""
- tell me
- activate
- repeat until theConfirmation = "OK"
- beep
- say (alarmText as text) without waiting until completion
- set theConfirmation to button returned of (display dialog (alarmText as text) buttons {"OK"} default button 1 giving up after alarmRepeatInterval)
- end repeat
- set volume alert volume prevAlertV
- set volume output volume prevOutputV
- if prevOutputM = true then
- set volume with output muted
- end if
- tell me to quit
- end tell
- end alarm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement