Skip to content

Instantly share code, notes, and snippets.

@c99koder
Last active December 7, 2017 21:25
Show Gist options
  • Select an option

  • Save c99koder/6773332 to your computer and use it in GitHub Desktop.

Select an option

Save c99koder/6773332 to your computer and use it in GitHub Desktop.

Revisions

  1. c99koder revised this gist Oct 23, 2013. 1 changed file with 88 additions and 12 deletions.
    100 changes: 88 additions & 12 deletions pebble.applescript
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,93 @@
    using terms from application "Messages"
    on message received theMessage from theBuddy for theChat
    my push((full name of theBuddy), theMessage)
    end message received

    on received text invitation theMessage from theBuddy for theChat
    my push((full name of theBuddy), theMessage)
    end received text invitation
    end using terms from

    on push(title, message)
    set APP_TOKEN to "..."
    set USER_KEY to "..."

    do shell script "curl -s -F token=" & APP_TOKEN & " -F user=" & USER_KEY & " -F title=\"" & title & "\" -F message=\"" & message & "\" https://api.pushover.net/1/messages.json"
    return
    end push
    end push

    using terms from application "Messages"
    on message received theMessage from theBuddy for theChat
    my push((full name of theBuddy), theMessage)
    end message received

    on chat room message received theMessage from theBuddy for theChat
    my push((full name of theBuddy), theMessage)
    end chat room message received

    on active chat message received theMessage
    #uncomment to push the active chat to Pebble
    #my push((full name of theBuddy), theMessage)
    end active chat message received

    on addressed chat room message received theMessage from theBuddy for theChat
    my push((full name of theBuddy), theMessage)
    end addressed chat room message received

    on addressed message received theMessage from theBuddy for theChat
    my push((full name of theBuddy), theMessage)
    end addressed message received

    # The following are unused but need to be defined to avoid an error

    on message sent theMessage for theChat

    end message sent

    on received text invitation theText from theBuddy for theChat

    end received text invitation

    on received audio invitation theText from theBuddy for theChat

    end received audio invitation

    on received video invitation theText from theBuddy for theChat

    end received video invitation

    on received remote screen sharing invitation from theBuddy for theChat

    end received remote screen sharing invitation

    on received local screen sharing invitation from theBuddy for theChat

    end received local screen sharing invitation

    on received file transfer invitation theFileTransfer

    end received file transfer invitation

    on buddy authorization requested theRequest

    end buddy authorization requested

    on av chat started

    end av chat started

    on av chat ended

    end av chat ended

    on login finished for theService

    end login finished

    on logout finished for theService

    end logout finished

    on buddy became available theBuddy

    end buddy became available

    on buddy became unavailable theBuddy

    end buddy became unavailable

    on completed file transfer

    end completed file transfer

    end using terms from
  2. c99koder renamed this gist Oct 1, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  3. c99koder renamed this gist Oct 1, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. c99koder renamed this gist Oct 1, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. c99koder renamed this gist Oct 1, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. c99koder created this gist Oct 1, 2013.
    17 changes: 17 additions & 0 deletions gistfile1.applescript
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    using terms from application "Messages"
    on message received theMessage from theBuddy for theChat
    my push((full name of theBuddy), theMessage)
    end message received

    on received text invitation theMessage from theBuddy for theChat
    my push((full name of theBuddy), theMessage)
    end received text invitation
    end using terms from

    on push(title, message)
    set APP_TOKEN to "..."
    set USER_KEY to "..."

    do shell script "curl -s -F token=" & APP_TOKEN & " -F user=" & USER_KEY & " -F title=\"" & title & "\" -F message=\"" & message & "\" https://api.pushover.net/1/messages.json"
    return
    end push