pythonpy-appscript

How to get Chrome's active_tab's url by calling Python's app script?


I want to get Google Chrome's active tab's url.

In Safari,

url = appscript.app('Safari').windows.first.current_tab.URL()

Above code works, but

    url = appscript.app('Google Chrome').windows.first.current_tab.URL()

it doesn't work

Do you have any idea? Thanks in advance.


Solution

  • Source Url --> http://reganmian.net/wiki/appscript

    url = appscript.app("Google Chrome").windows[1].get.tabs[dt.windows[1].get.active_tab_index.get].get.URL.get