Jump to content
Macro Express Forums

Select between windows which have indistinguishable titles.

Recommended Posts

I have started using "private Browsing" with Firefox. 

This results in two windows - a "non-private" window with possibly multiple tabs, and a "private" window with possibly multiple tabs.


I'd like my MEP shortcut key to go to, say, the non-private window, but if I'm already there, go to the private window.


Since the "activate window" title is variable but ends in:

"Mozilla Firefox (Private Browsing)"
"Mozilla Firefox"

I can't distinguish between them - so if I'm in the private browsing window and say to activate "Mozilla Firefox" -- wanting the OTHER window -- it is happy to do nothing - after all "Mozilla Firefox" is in the title containing (Private Browsing).


 I could "hack" issuing an alt-tab to the "next" window, stopping when the window title has "Mozilla Firefox" -- by definition either back to the ONLY Firefox window, or advancing to the "other" one.   Not elegant enough, flashing windows, etc.


Thanks for any ideas.

Link to comment
Share on other sites

Maybe something like this? This script seems to switch between private browsing and non-private browsing windows.


Variable Set String %WinTitle% to topmost window title
If Variable %WinTitle% Contains "Mozilla Firefox (Private Browsing)"
  Set Window Order "<Current Window>" Place on bottom // Move to the bottom of the stack of windows
  Window Activate: Mozilla Firefox
  Window Activate: Mozilla Firefox (Private Browsing)
End If

<VARIABLE SET STRING Option="\x05" Destination="%WinTitle%"/>
<IF VARIABLE Variable="%WinTitle%" Condition="\x06" Value="Mozilla Firefox (Private Browsing)" IgnoreCase="FALSE"/>
<SET WINDOW ORDER Window="\x00" Partial="TRUE" Wildcards="FALSE" Action="\x02" _IGNORE="0x0006" _COMMENT="Move to the bottom of the stack of windows"/>
<WINDOW ACTIVATE Title="Mozilla Firefox" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<WINDOW ACTIVATE Title="Mozilla Firefox (Private Browsing)" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/>
<END IF/>	


Link to comment
Share on other sites

Ah, 'tis truly a work of art!  Learned some new things.   THANKS!!!


Reminds me of an old rule I seem to no longer follow: 

1. Read up on new software

2. use it for a while

3. go back and see what you forgot/missed.


So poking about all the functions would be a good idea!


LOVE posting both versions of the macro!!!





  • Haha 1
Link to comment
Share on other sites

Glad my script set you in the right direction. I imagine you'll be able to tweak the script to do what you need it to do. 


I've been using Macro Express for about 20 years, and I'm still finding new ways to use the program to automate tasks, simplify routine operations, and repair accessibility and usability problems.

Link to comment
Share on other sites

 I just added a few lines to launch if NO Firefox is active.

If Window "— Mozilla Firefox" is focused
  Macro Return
End If
Activate or Launch: Window "Mozilla Firefox", Program "firefox.exe", Parameters ""


Thanks again!


P.S. when I invented and programmed the world's first Bulletin Board System, I suffered from "Rampant Featureitis".   I was ALWAYS thinking of new things to tweak, haha.


SO FOR THIS macro, my next "tweak", would be that if I'm on the non-private-browsing Firefox, and I switch to the private-browsing one, BUT it isn't there, then I'd issue a ctrl-shift-P command in Firefox to open a new window with private browsing.   Or not.  heh.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...