Skip to content

Instantly share code, notes, and snippets.

@arjunattam
Created April 28, 2022 10:21
Show Gist options
  • Save arjunattam/e51d3e3952f97f6bf4cbcf67f04ae100 to your computer and use it in GitHub Desktop.
Save arjunattam/e51d3e3952f97f6bf4cbcf67f04ae100 to your computer and use it in GitHub Desktop.
Open a new Chrome window with Safari tabs from your phone
set newline to {return & linefeed, return, linefeed, character id 8233, character id 8232}
on split_text(the_text, the_delimiter)
set AppleScript's text item delimiters to the_delimiter
set the_text_items to every text item of the_text
set AppleScript's text item delimiters to ""
return the_text_items
end split_text
set the_query to "'select url from cloud_tabs where device_uuid = (select device_uuid from cloud_tab_devices where device_name like \"%iPhone%\")'"
set the_cmd to "sqlite3 ~/Library/Containers/com.apple.Safari/Data/Library/Safari/CloudTabs.db " & the_query
set the_result to do shell script the_cmd
set the_list to split_text(the_result, newline)
tell application "Google Chrome"
make new window
activate
open location the_list
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment