iSleep implements an AppleScript dictionary, which can be used at will and offers you a way to extend iSleep's possibilities with the power of AppleScript! Here are a few examples and explanations about the dictionary.
Please note that a little knowledge of AppleScript is required to use those functions.
Generally, you should avoid changing settings after having hit the "Go to Bed" button or used a command to that effect. Always hit Stop or use the stop command before changing settings.
sleeping delay real -- play music or a movie for this many seconds when going to bed
Example: set sleeping delay to 120
sets the delay until sleep to 2 minutes
wake up time date -- when will iSleep wake you up
Example:
set cur_date to (current date) + 8 * hours
set wake up time to cur_date
sets the time when iSleep will wake you up, for instance here 8 hours after the script has been run.
remaining time real [r/o] -- remaining time, in seconds, before sleeping
Example: set rem_time to remaining time
returns a value in seconds. Note this is a read-only command.
counting down boolean [r/o] -- is iSleep counting down to sleep ?
Example: set status to counting down
returns true
or false
. Read-only.
go to bed: Start the music or the DVD and start counting down to sleep
Example: tell application "iSleep" to go to bed
results in the same as if you click on the "Go To Bed" button.
snooze [for]: Stop the music from the alarm clock
Example: tell application "iSleep" to snooze for 240
causes iSleep to stop the music playback for 4 minutes. tell application "iSleep" to snooze
will stop the music playback for the duration set in iSleep's preferences (default 5 minutes), as if you had pressed the space bar.
stop: Stop the countdown
Example: tell application "iSleep" to stop
tells iSleep to stop the "Go To Bed" procedure. Same as clicking the
Stop button.