diff --git a/add-to-reading-list b/add-to-reading-list new file mode 100755 index 0000000..72e1319 --- /dev/null +++ b/add-to-reading-list @@ -0,0 +1,11 @@ +#!/bin/sh + +TITLE="$1" +URL="$2" + +if [[ "$TITLE" != "" ]] && [[ "$URL" != "" ]]; then + osascript -e "tell application \"Safari\" to add reading list item \"${URL}\" with title \"${TITLE}\"" +else + echo "usage: `basename $0` <url>" + exit 1 +fi diff --git a/chrome-to-reading-list b/chrome-to-reading-list new file mode 100755 index 0000000..98a5f8e --- /dev/null +++ b/chrome-to-reading-list @@ -0,0 +1,20 @@ +#!/bin/bash + +AS_GET_TITLE=' + tell application "Google Chrome" + set frontIndex to active tab index of front window + get title of tab frontIndex of front window + end tell +' + +AS_GET_URL=' + tell application "Google Chrome" + set frontIndex to active tab index of front window + get URL of tab frontIndex of front window + end tell +' + +TITLE=`osascript - <<<"$AS_GET_TITLE"` +URL=`osascript - <<<"$AS_GET_URL"` + +~/bin/add-to-reading-list "$TITLE" "$URL"