I’ve trawled MacUpdate but can’t find anything that does what I need. However, SweatShop for the PC does, but obviously not for the Mac.
I’m after a timer that I can input how many seconds I want an exercise and rest period to last for. The timer then runs through both periods in sequence and repeats until a STOP button is pressed.
For example, it counts down for 15 seconds, then beeps, then continues for another 45 seconds, then beeps.
However, I also want it to show me how many times it has repeated so I can keep a visual track of the number of repetitions I’ve done.
It’s like a boxing round with someone saying round 1, boxing starts, then they rest, then someone says round 2, boxing starts, rest, etc.
Something like the scrip below? If you want to keep track of the beep count, you better get starting with AppleScript Studio.
Script (Save as a stay-open application):
global mySeconds
global idleFlag
global idleCount
on run
--// SETUP VARIABLES //--
set mySeconds to {}
set idleFlag to false
set idleCount to 1
--// SETUP VARIABLES //--
set myDialog to checkForValidInteger((display dialog "Seconds before first beep?" default answer "" buttons {"Cancel", "Finish", "Next Timer"} default button 3))
set end of mySeconds to text returned of myDialog as integer
-- if "Cancel"
if button returned of myDialog is "Cancel" then
quit me
end if
-- if "Finish"
if button returned of myDialog is "Finish" then
set idleFlag to true
end if
-- if "Next Timer"
if button returned of myDialog is "Next Timer" then
set repeatFlag to true
set dialogCount to 2
repeat while repeatFlag is true
set myDialog to checkForValidInteger((display dialog ("Seconds before beep " & dialogCount & "?") buttons {"Quit", "Finish", "Next Timer"} default button 3 default answer ""))
set end of mySeconds to text returned of myDialog as integer
-- if "Quit"
if button returned of myDialog is "Quit" then
quit me
end if
-- if "Finish"
if button returned of myDialog is "Finish" then
set idleFlag to true
set repeatFlag to false
end if
-- if "Next Timer"
if button returned of myDialog is "Next Timer" then
set dialogCount to dialogCount + 1
end if
end repeat
end if
end run
on idle
if idleFlag is false then
return 1
end if
if idleFlag is true then
if ((count mySeconds) = idleCount) then quit me
-- display dialog "idleCount :" & idleCount & return & "secondsCount: " & ((count mySeconds) as string)
if idleCount is not 1 then beep
set myReturn to (item idleCount of mySeconds) as integer
set idleCount to idleCount + 1
return myReturn
end if
end idle
on checkForValidInteger(passedDialog) -- returns dialog
try
set givenAnswer to (text returned of passedDialog) as integer
return passedDialog
on error
set myDialog to display dialog "The answer has to be an integer" buttons {"Cancel", "Finish", "Next Timer"} default button 3 default answer ""
set myDialog to checkForValidInteger(myDialog)
return myDialog
end try
end checkForValidInteger
You did save it as a stay-open application, did you?
This should do it (not tested tough);
global mySeconds
global idleFlag
global firstIdle
global itemCount
on run
--// SETUP VARIABLES //--
set mySeconds to {}
set firstIdle to true
set idleFlag to false
set itemCount to 1
--// SETUP VARIABLES //--
set myDialog to checkForValidInteger((display dialog "Seconds before first beep?" default answer "" buttons {"Cancel", "Second Timer"} default button 2 cancel button 1))
set end of mySeconds to text returned of myDialog as integer
set myDialog to checkForValidInteger((display dialog "Seconds before second beep?" default answer "" buttons {"Cancel", "Go."} default button 1 cancel button 1))
set end of mySeconds to text returned of myDialog as integer
-- go to idle handler
set idleFlag to true
end run
on idle
if idleFlag is false then
return 1
else
set myReturn to (item itemCount of mySeconds) as integer
if firstIdle is true then
beep
else
set firstIdle to true
end if
if itemCount is 1 then
set itemCount to 2
else
set itemCount to 1
end if
return myReturn
end if
end idle
on checkForValidInteger(passedDialog) -- returns dialog
try
set givenAnswer to (text returned of passedDialog) as integer
return passedDialog
on error
set myDialog to display dialog "The answer has to be an integer" buttons {"Cancel", "Finish", "Next Timer"} default button 3 default answer ""
set myDialog to checkForValidInteger(myDialog)
return myDialog
end try
end checkForValidInteger