Hey guys, I’m writing a wake up app in AS Studio and I need a new functionality, but I can’t get it to work. I am using iTunes to play music and just controlling it with my app. What I want to do is, after a minute with no response from the user I want to turn the volume up, then in another minute, do the same thing, and in another minute, just start annoying beeping so hopefully it wakes me up and I don’t sleep through it again. The problem I ran into is this: when I use the Repeat it just stays there and won’t let the user hit any buttons or even quit the app. I have this new bit of code in another function if that makes any difference.
Any help would be appreciated
Here is my new function:
on MakeSureTheyWake()
-- Turns up the volume to make sure the user wakes up
-- Problem: if this code runs, the user cannot quit, ever
set CounterVar1 to 1
set CounterVar2 to 1
repeat 3 times
repeat 60 times
delay 1
set CounterVar2 to CounterVar2 + 1
if CounterVar2 is equal to 60 then
if iTunesVolume is less than 60 then
set VolLoudness to iTunesVolume * 0.2
set iTunesVolume to iTunesVolume + VolLoudness
tell application "iTunes"
set sound volume to iTunesVolume
end tell
exit repeat
else if systemVolume is less than 60 then
set VolLoudness to systemVolume * 0.2
set systemVolume to systemVolume + VolLoudness
tell application "Finder"
set volume output volume systemVolume
end tell
end if
end if
end repeat
set CounterVar1 to CounterVar1 + 1
if CounterVar1 is equal to 3 then
set VolLoudness to systemVolume * 0.2
set systemVolume to systemVolume + VolLoudness
tell application "Finder"
set volume output volume systemVolume
end tell
repeat 20 times
beep
delay 1
end repeat
end if
end repeat
end MakeSureTheyWake