Skip to content

Instantly share code, notes, and snippets.

@hiilppp
Created April 16, 2014 19:19

Revisions

  1. hiilppp created this gist Apr 16, 2014.
    35 changes: 35 additions & 0 deletions leaving_range.scpt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    do shell script "defaults write com.apple.screensaver askForPassword 1; defaults write com.apple.screensaver askForPasswordDelay 0"

    repeat until (do shell script "defaults read com.apple.screensaver askForPassword") = "1" and (do shell script "defaults read com.apple.screensaver askForPasswordDelay") = "0"
    delay 0.5
    end repeat

    tell application "ScreenSaverEngine" to activate

    if application "iTunes" is running then
    tell application "iTunes"
    if player state is playing then
    set initial_sound_volume to the sound volume
    set i to initial_sound_volume
    repeat until i = 0
    set i to i - 1
    set sound volume to i
    delay 0.1
    end repeat
    pause
    set sound volume to initial_sound_volume
    end if
    end tell
    end if

    if application "OmniFocus" is running then
    tell first document of application "OmniFocus"
    synchronize
    (*
    repeat until syncing is false
    delay 0.1
    end repeat
    do shell script "date \"+%-d.%-m.%Y, %-H:%M:%S\" > \"$HOME/Dropbox/var/lib/of/ls.txt\""
    *)
    end tell
    end if