0

Is there any way to perform an action of a specific URL is open in say a Chrome tab/any other browser?

  • I will not downvote, but it would be nice if you explained it better. – Haroldo_OK Nov 20 '18 at 09:27
  • 1
    What i mean, is say you opened a tab in chrome with a url say https://www.google.com/ the python script would sense that and say print "Google has been opened" –  Nov 20 '18 at 09:29
  • You can do something like that on Windows. Maybe other OSs, too. – martineau Nov 20 '18 at 09:29
  • Would you care to explain how? –  Nov 20 '18 at 09:31
  • Even though the title doesn't sound remotely related, check out [my answer](https://stackoverflow.com/a/42178357/355230) to the question [Access variable inside an non-return function from other package without global variable](https://stackoverflow.com/questions/42177911/access-variable-inside-an-non-return-function-from-other-package-without-global). The crucial API functions are named `win32gui.EnumWindows()` and `win32gui.GetWindowText()`. – martineau Nov 20 '18 at 10:03

1 Answers1

0

You could try writing a Native Messaging Host in Python, plus a Chrome extension, so that every time a certain URL would be open, it would notify the native host.

See this: Native messaging host in Python

Haroldo_OK
  • 6,612
  • 3
  • 43
  • 80