Find right Window (multiple instances)

If you have a question or need help, this is the place to be.
Post Reply
Search&Destroy
Posts: 25
Joined: Wed Aug 19, 2009 10:40 am

Find right Window (multiple instances)

Post by Search&Destroy » Sat Dec 30, 2017 12:27 am

Hey there,

I have 2 profiles for Vivaldi (Chrome based Browser that wants to replace the old Opera) which have different bookmarks/settings/etc.

I created this 2 profiles with 2 seperate shortcuts that have different targets (at shortcut properties)
First shortcut target:
"C:\Program Files (x86)\Vivaldi\Application\vivaldi.exe" --user-data-dir="C:\Users\Admin\AppData\Local\Vivaldi\User Data\PROFILE1"
Second shortcut target:
"C:\Program Files (x86)\Vivaldi\Application\vivaldi.exe" --user-data-dir="C:\Users\Admin\AppData\Local\Vivaldi\User Data\PROFILE2"

PROFILE1 and PROFILE2 are just example names.

I just tell you that, because these shortcuts use the same vivaldi.exe file to launch the browser, but the browser knows he has to load a special profile.
Now I want to find the right window with EventGhost so I can manipulate the window itself (size, position, etc.)

Sure, I tried the 'Drag Finder' but it can't tell apart the 2 profiles (maybe because of the same vivaldi.exe file)...


Any ideas so far?

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

Re: Find right Window (multiple instances)

Post by kgschlosser » Mon Jan 01, 2018 5:21 pm

question.

Is the name of the profile in the title of the window?
If you like the work I have been doing then feel free to Image

Search&Destroy
Posts: 25
Joined: Wed Aug 19, 2009 10:40 am

Re: Find right Window (multiple instances)

Post by Search&Destroy » Fri Jan 05, 2018 6:39 am

No, the title is always the line between <title></title> tags of that page.

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

Re: Find right Window (multiple instances)

Post by kgschlosser » Fri Jan 05, 2018 8:04 am

hmmm...


you can use Task Monitor Plus along with the Enable action and the disable action to accomplish what you need.

The payload in the event that is generated by TMP (Task Monitor Plus) contains a whole bunch of convenience functions for controlling the window.

You would set up something like this

Code: Select all

macro window control profile 1
	event from TMP for vivaldi.exe, or the browser depending on how it comes up
	Python command action - eg.globals.profile_1 = eg.event.payload
	disable action - disable macro window control profile 1 and return
	
macro window control profile 2
	event from TMP for vivaldi.exe, or the browser depending on how it comes up
	Python command action - eg.globals.profile_2 = eg.event.payload
	disable action - disable macro window control profile 2 and return
	
macro profile 1
	event that causes profile 1 to run
	enable action - enable macro window control profile 1 and return
	action that runs  vivaldi.exe for profile 1
	
macro profile 2
	event that causes profile 2 to run
	enable action - enable macro window control profile 2 and return
	action that runs  vivaldi.exe for profile 2
and whenever you want you can access each of the profiles from PythonScripts.PythonCommand actions.

eg.globals.profile_1
eg.globals.profile_2

after one of the profiles has been opened if you click on the help drop down and click on the python shell item. in there key in

Code: Select all

help(eg.globals.profile_1)
or eg.globals.profile_2 whichever profile you have loaded. either or will contain the same information

This is going to show you all of the available functions. if you want to know more information about a specific function

Code: Select all

help(eg.globals.profile_1.SOME_FUNCTION_NAME)
Here is a list of the functions that are available

Code: Select all

    IsAlive
    IsActive
    Animate
    SendKeystrokes
    Flash
    BringToTop
    IsVisible
    EnableKeyboardMouse
    IsKeyboardMouseEnabled
    Restore
    Minimize
    Maximize
    SetPosition
    SetSize
    SetRect
    GetRect
    GetRectTuple
    GetSize
    GetSizeTuple
    GetPosition
    GetPositionTuple
    Show
    Hide
    Destroy
    Close
    SendMessage
    PostMessage
    GetParent
    Focus
    HasFocus
If you like the work I have been doing then feel free to Image

Post Reply