add scripts to send links to Safari's Reading List

This commit is contained in:
Sami Samhuri 2013-11-07 13:17:04 -08:00
parent 1322ef3535
commit dfbedc02b0
2 changed files with 31 additions and 0 deletions

11
add-to-reading-list Executable file
View file

@ -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` <title> <url>"
exit 1
fi

20
chrome-to-reading-list Executable file
View file

@ -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"