Find Window issue with Chrome

Questions and comments specific to a particular plugin should go here.
Post Reply
wysocki
Experienced User
Posts: 65
Joined: Mon Nov 23, 2015 9:23 pm
Location: Los Angeles area

Find Window issue with Chrome

Post by wysocki » Tue Mar 24, 2020 11:13 pm

I'm trying to use the Find Window action to close a Chrome browser window that's open to a specific URL. Even if I have multiple windows open with sometimes multiple tabs I can't select the window I want to close. They all show up as:
  • program=chrome.exe
    name=Chrome Legacy Window
    Class=Chrome_RenderWidgetHostHWND
They do have different handles, but those are assigned arbitrarily when the window is created so I can't use that.
Is it possible to select the window I want by some other criteria?

(PS: There is only one bullet in the above list because the editor puts in <br> codes instead of <li> for each line. Bug?)

User avatar
kgschlosser
Site Admin
Posts: 5214
Joined: Fri Jun 05, 2015 5:43 am
Location: Rocky Mountains, Colorado USA

Re: Find Window issue with Chrome

Post by kgschlosser » Wed Mar 25, 2020 8:06 pm

  • This
  • Seems
  • to
  • be
  • working
  • fine
you need to use bbcodes and not html.

[ list ]
[ * ] item 1
[ * ] item 2
[ * ] item 3
[ /list ]

remove the spaces between the brackets.
  • you can even nest lists
    • as you
    • can see here
Now as far as being able to close a chrome browser. There has been a plugin made that will allow you to interface with Chrome and you can actually single out a tab you wish to close. Or you can optionally use the Task Monitor Plus plugin. when using the task monitor plus plugin you will need to hold a reference to the payload of the event in a global. The Task Monitor Plus plugin will create an event if the Title of an application changes. The title is the caption bar at the top of the application window. All browsers will show the page currently being displayed in the title. You can use this event to store the payload using a Python command

Code: Select all

eg.globals.chrome_window  = eg.event.payload
and when you want to close the Window you would use a Python Script action to do so.

Code: Select all

# this checks if the variable exists and if it does not then to create it and set it to None.
eg.globals.chrome_window = getattr(eg.globals, 'chrome_window', None)


if (
    eg.globals.chrome_window is not None and
    eg.globals.chrome_window.IsAlive()
):
    eg.globals.chrome_window.Close()
   
eg.globals.chrome_window = None

This is actually a much better way to go about it because using Find Window is expensive to run. The more applications you have open the longer it is going to take to locate a Window. By going about it the way I have shown above the Window does not need to be searched for. Again there is also the Chrome plugin that will allow you to isolate a specific tab and close it. This is something that cannot be done with the Task Monitor Plus plugin or with the Find Window action.
If you like the work I have been doing then feel free to Image

Post Reply