Last active
October 28, 2022 00:31
-
-
Save glallen01/5e7602e5f4972c49fd9e8bf4cb0d19ee to your computer and use it in GitHub Desktop.
get tab urls from chrome into org-mode with applescript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun gla/chrome-tabs-to-org () | |
(interactive) | |
;; adopted from applescript found here: https://pastebin.com/AXDtWJKL | |
(let* ((osascript-urls (do-applescript " | |
tell application \"Google Chrome\" | |
set allUrls to {} | |
repeat with theWindow in every window | |
set urlsInWindow to {} | |
repeat with theTab in every tab of theWindow | |
set currentUrl to the theTab\'s URL | |
set urlsInWindow to urlsInWindow & {currentUrl} | |
end repeat | |
set allUrls to allUrls & {urlsInWindow} | |
end repeat | |
end tell | |
")) | |
(urls (split-string (replace-regexp-in-string "[\"{}]+" "" osascript-urls) ", "))) | |
(insert (mapconcat (lambda (x) (format "- [[%s]]\n" x)) urls "")))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment