1

I have this idea in my mind that every morning, when I first open my computer, all programs are closed except Day One, so that I can start journaling first thing every day without any distractions.

I think it should be possible using a combination of AppleScript and Automator (and maybe a few other things), but I'm new to the Mac world, so I need a little bit of help.

Here's some pseudocode that shows what I'm thinking;

on wakeup, if time is between 6am and 8:30am
    quit all apps except Day One
    start Day One
end if

Pretty simple, but I don't know where to script it or how.

1

I installed SleepWatcher via MacPorts and set it up to run the following AppleScript on wakeup;

if hours of the (current date) is greater than 6 then if hours of the (current date) is less than 9 then
    tell application "System Events"
        set theResults to get buttons of (windows of (application processes whose visible is true)) whose description is "close button" -- a list of visible applications, containing a list of windows, containing a list of (one) buttons

        repeat with anApp in theResults
            if contents of anApp is not in {} then -- windows are open
                repeat with eachWindow in (items of anApp)
                    click first item of eachWindow -- only the one minimize button
                end repeat
            end if
        end repeat
    end tell

    tell application "Day One" to activate
end if

If the time is between 6am and 8am when the wakeup script is activated, it closes all open windows and launches Day One.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.