Chris Redford
Chris Redford

Reputation: 17768

Determine current Mac Chrome web page using Python (py-appscript)

So Chromium has officially added support for Applescript:

http://code.google.com/p/chromium/issues/detail?id=27468

I assume that this also means Chromium can be accessed by py-appscript. The question is: how? What syntax in py-appscript can I use to get the URL of the front-most tab in Chromium?

Upvotes: 0

Views: 285

Answers (1)

Chris Redford
Chris Redford

Reputation: 17768

Found it. It is:

appscript.app("Google Chrome").windows.active_tab.URL()

The way I found it was by calling .help() successively.

So, first, I called the appscript.app("Google Chrome").help(), which listed out all of the app's accessible properties and alerted me that I needed to access it's windows property.

Then I called appscript.app("Google Chrome").windows.help(), which listed out the properties of windows, etc.

I feel like a bit of a n00b for not remembering this about Python but hopefully this information helps someone else if they are stuck on appscript.

Upvotes: 1

Related Questions