Tutorial by Examples

From the Terminal command line Get the current URL from Safari osascript -e 'tell app "safari" to get the url of the current tab of window 1' Get the active URL in Google Chrome osascript -e 'tell app "google chrome" to get the url of the active tab of window 1'
Get the name of the web page in Safari osascript -e 'tell app "safari" to get the name of the current tab of window 1' Get the title of the web page in Google Chrome osascript -e 'tell app "google chrome" to get the title of the active tab of window 1'
You're not limited to single line Applescript code. Here we take the previous two examples and combine them into a single function. #!/bin/bash pageinfo() { osascript -e \ 'tell app "safari" tell the current tab of window 1 return {url & "\n" & ...

Page 1 of 1