├── .gitignore ├── README.md ├── scripts ├── Open Bookmarks with Selected Tag in Chrome.applescript ├── Open Bookmarks with Selected Tag in Safari.applescript ├── Open Bookmarks with Input Tag in Chrome.applescript ├── Open Bookmarks with Input Tag in Safari.applescript ├── Create Bookmark from Current Tab in Safari.applescript ├── Create Bookmark from Current Tab in Chrome.applescript ├── Write Selected Bookmarks to Clipboard.applescript ├── Create Bookmark from Current Tab in Safari Directly.applescript ├── Create Bookmark from Current Tab in Chrome Directly.applescript └── Create Email with Selected Bookmarks.applescript └── LICENSE /.gitignore: -------------------------------------------------------------------------------- 1 | *~ 2 | @* 3 | .DS_Store 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | AppleScript and Spillo 2 | ================== 3 | 4 | Spillo has full AppleScript support for browsing, creating and updating bookmaks so it’s easily extandable. 5 | 6 | AppleScript can be a little daunting if you’ve never used it before so here’s a list of examples that accomplish cool things and really extend the capabilities of Spillo. 7 | -------------------------------------------------------------------------------- /scripts/Open Bookmarks with Selected Tag in Chrome.applescript: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | *) 4 | tell application "Spillo" 5 | if selected tag exists then 6 | set bookmark_list to the url of every bookmark in selected tag 7 | 8 | tell application "Google Chrome" 9 | if not (front window exists) then 10 | make new document 11 | end if 12 | 13 | tell front window 14 | repeat with bookmark_url in bookmark_list 15 | make new tab with properties {URL:bookmark_url} 16 | end repeat 17 | end tell 18 | end tell 19 | else 20 | display dialog "There is no tag currently selected in Spillo." buttons {"OK"} default button 1 21 | end if 22 | end tell 23 | -------------------------------------------------------------------------------- /scripts/Open Bookmarks with Selected Tag in Safari.applescript: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | *) 4 | tell application "Spillo" 5 | if selected tag exists then 6 | set bookmark_list to the url of every bookmark in selected tag 7 | 8 | tell application "Safari" 9 | if not (front window exists) then 10 | make new document 11 | end if 12 | 13 | tell front window 14 | repeat with bookmark_url in bookmark_list 15 | set current tab to (make new tab with properties {URL:bookmark_url}) 16 | end repeat 17 | end tell 18 | end tell 19 | else 20 | display dialog "There is no tag currently selected in Spillo." buttons {"OK"} default button 1 21 | end if 22 | end tell 23 | -------------------------------------------------------------------------------- /scripts/Open Bookmarks with Input Tag in Chrome.applescript: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | *) 4 | display dialog "Which tag do you want to dump bookmarks in Chrome for?" default answer "" 5 | set tag_title to text returned of result 6 | 7 | tell application "Spillo" 8 | if (first tag whose title is tag_title) exists then 9 | set matched_tag to first tag whose title is tag_title 10 | set bookmark_list to the url of every bookmark in matched_tag 11 | 12 | tell application "Google Chrome" 13 | if not (front window exists) then 14 | make new window 15 | end if 16 | 17 | tell front window 18 | repeat with bookmark_url in bookmark_list 19 | make new tab with properties {URL:bookmark_url} 20 | end repeat 21 | end tell 22 | end tell 23 | else 24 | display dialog "There is no tag that matches this query." 25 | end if 26 | end tell 27 | -------------------------------------------------------------------------------- /scripts/Open Bookmarks with Input Tag in Safari.applescript: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | *) 4 | display dialog "Which tag do you want to dump bookmarks in Safari for?" default answer "" 5 | set tag_title to text returned of result 6 | 7 | tell application "Spillo" 8 | if (first tag whose title is tag_title) exists then 9 | set matched_tag to first tag whose title is tag_title 10 | set bookmark_list to the url of every bookmark in matched_tag 11 | 12 | tell application "Safari" 13 | if not (front window exists) then 14 | make new document 15 | end if 16 | 17 | tell front window 18 | repeat with bookmark_url in bookmark_list 19 | set current tab to (make new tab with properties {URL:bookmark_url}) 20 | end repeat 21 | end tell 22 | end tell 23 | else 24 | display dialog "There is no tag that matches this query." 25 | end if 26 | end tell 27 | -------------------------------------------------------------------------------- /scripts/Create Bookmark from Current Tab in Safari.applescript: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | *) 4 | tell application "Safari" 5 | if current tab of front window exists then 6 | set current_tab to current tab of front window 7 | 8 | set js_script to " 9 | var selection = window.getSelection().toString(); 10 | 11 | if (!selection) { 12 | var meta = document.getElementsByTagName('meta'); 13 | for (var idx = 0; idx < meta.length; idx++) { 14 | if (meta[idx].name.toLowerCase() === 'description') { 15 | selection = meta[idx].content; 16 | break; 17 | } 18 | } 19 | } 20 | 21 | selection; 22 | " 23 | 24 | set tab_title to name of current_tab 25 | set tab_address to URL of current_tab 26 | set tab_description to do JavaScript js_script in current_tab 27 | 28 | tell application "Spillo" 29 | show create bookmark panel with properties {url:tab_address, title:tab_title, desc:tab_description} 30 | end tell 31 | end if 32 | end tell -------------------------------------------------------------------------------- /scripts/Create Bookmark from Current Tab in Chrome.applescript: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | *) 4 | tell application "Google Chrome" 5 | if active tab of front window exists then 6 | set active_tab to active tab of front window 7 | 8 | set js_script to " 9 | var selection = window.getSelection().toString(); 10 | 11 | if (!selection) { 12 | var meta = document.getElementsByTagName('meta'); 13 | for (var idx = 0; idx < meta.length; idx++) { 14 | if (meta[idx].name.toLowerCase() === 'description') { 15 | selection = meta[idx].content; 16 | break; 17 | } 18 | } 19 | } 20 | 21 | selection; 22 | " 23 | 24 | set tab_title to title of active_tab 25 | set tab_address to URL of active_tab 26 | set tab_description to execute active_tab javascript js_script 27 | 28 | tell application "Spillo" 29 | show create bookmark panel with properties {url:tab_address, title:tab_title, desc:tab_description} 30 | end tell 31 | end if 32 | end tell -------------------------------------------------------------------------------- /scripts/Write Selected Bookmarks to Clipboard.applescript: -------------------------------------------------------------------------------- 1 | tell application "Spillo" 2 | set content_string to "" 3 | 4 | set selected_bookmarks to selected bookmarks 5 | repeat with current_bookmark in selected_bookmarks 6 | set bookmark_title to title of current_bookmark 7 | if bookmark_title is not "" then 8 | set content_string to content_string & bookmark_title & return 9 | end if 10 | 11 | set bookmark_url to url of current_bookmark 12 | if bookmark_url is not "" then 13 | set content_string to content_string & bookmark_url & return 14 | end if 15 | 16 | set bookmark_desc to desc of current_bookmark 17 | if bookmark_desc is not "" then 18 | set content_string to content_string & bookmark_desc & return 19 | end if 20 | 21 | set content_string to content_string & return 22 | end repeat 23 | 24 | set the clipboard to content_string 25 | end tell 26 | -------------------------------------------------------------------------------- /scripts/Create Bookmark from Current Tab in Safari Directly.applescript: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | *) 4 | tell application "Safari" 5 | if current tab of front window exists then 6 | set current_tab to current tab of front window 7 | 8 | set js_script to " 9 | var selection = window.getSelection().toString(); 10 | 11 | if (!selection) { 12 | var meta = document.getElementsByTagName('meta'); 13 | for (var idx = 0; idx < meta.length; idx++) { 14 | if (meta[idx].name.toLowerCase() === 'description') { 15 | selection = meta[idx].content; 16 | break; 17 | } 18 | } 19 | } 20 | 21 | selection; 22 | " 23 | 24 | set tab_title to name of current_tab 25 | set tab_address to URL of current_tab 26 | set tab_description to do JavaScript js_script in current_tab 27 | 28 | tell application "Spillo" 29 | make new bookmark with properties {url:tab_address, title:tab_title, desc:tab_description} 30 | save 31 | refresh 32 | end tell 33 | end if 34 | end tell -------------------------------------------------------------------------------- /scripts/Create Bookmark from Current Tab in Chrome Directly.applescript: -------------------------------------------------------------------------------- 1 | (* 2 | 3 | *) 4 | tell application "Google Chrome" 5 | if active tab of front window exists then 6 | set active_tab to active tab of front window 7 | 8 | set js_script to " 9 | var selection = window.getSelection().toString(); 10 | 11 | if (!selection) { 12 | var meta = document.getElementsByTagName('meta'); 13 | for (var idx = 0; idx < meta.length; idx++) { 14 | if (meta[idx].name.toLowerCase() === 'description') { 15 | selection = meta[idx].content; 16 | break; 17 | } 18 | } 19 | } 20 | 21 | selection; 22 | " 23 | 24 | set tab_title to title of active_tab 25 | set tab_address to URL of active_tab 26 | set tab_description to execute active_tab javascript js_script 27 | 28 | tell application "Spillo" 29 | make new bookmark with properties {url:tab_address, title:tab_title, desc:tab_description} 30 | save 31 | refresh 32 | end tell 33 | end if 34 | end tell 35 | -------------------------------------------------------------------------------- /scripts/Create Email with Selected Bookmarks.applescript: -------------------------------------------------------------------------------- 1 | tell application "Spillo" 2 | set content_string to "" 3 | 4 | set selected_bookmarks to selected bookmarks 5 | repeat with current_bookmark in selected_bookmarks 6 | set bookmark_title to title of current_bookmark 7 | if bookmark_title is not "" then 8 | set content_string to content_string & bookmark_title & return 9 | end if 10 | 11 | set bookmark_url to url of current_bookmark 12 | if bookmark_url is not "" then 13 | set content_string to content_string & bookmark_url & return 14 | end if 15 | 16 | set bookmark_desc to desc of current_bookmark 17 | if bookmark_desc is not "" then 18 | set content_string to content_string & bookmark_desc & return 19 | end if 20 | 21 | set content_string to content_string & return 22 | end repeat 23 | 24 | tell application "Mail" 25 | make new outgoing message with properties {visible:true, content:content_string} 26 | end tell 27 | end tell 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Damien DeVille 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | --------------------------------------------------------------------------------