→ Dr. Drang on Getting URLs from Safari

He shares a Textexpander Applescript snippet that gets the URL of the front-most open tab:

tell application "Safari" to get the URL of the front document

Genius. He has a github repository of this and similar snippets as well.