WardXmodem Posted April 21, 2021 Report Share Posted April 21, 2021 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)" -or- "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. Quote Link to comment Share on other sites More sharing options...
acantor Posted April 21, 2021 Report Share Posted April 21, 2021 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 Else 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"/> <ELSE/> <WINDOW ACTIVATE Title="Mozilla Firefox (Private Browsing)" Exact_Match="FALSE" Wildcards="FALSE" _IGNORE="0x0006"/> <END IF/> Quote Link to comment Share on other sites More sharing options...
WardXmodem Posted April 22, 2021 Author Report Share Posted April 22, 2021 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!!! Nice!! VV 1 Quote Link to comment Share on other sites More sharing options...
WardXmodem Posted April 22, 2021 Author Report Share Posted April 22, 2021 OOPS, I missed that you didn't do an "activate or launch". so will have to tweak it. A non-private-browsing Firefox window is open, but the hotkey doesn't switch to it. But at least the swapping is working! Quote Link to comment Share on other sites More sharing options...
acantor Posted April 22, 2021 Report Share Posted April 22, 2021 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. Quote Link to comment Share on other sites More sharing options...
WardXmodem Posted April 23, 2021 Author Report Share Posted April 23, 2021 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. Quote Link to comment Share on other sites More sharing options...
acantor Posted April 23, 2021 Report Share Posted April 23, 2021 I hope you'll post your completed (or almost completed!) script after you're happy with it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.