oded Posted May 18, 2016 Report Share Posted May 18, 2016 Using IE or Chrome I have several open tabs and want MEP to close one of them How can this be done? Quote Link to comment Share on other sites More sharing options...
Cory Posted May 18, 2016 Report Share Posted May 18, 2016 In Chrome it's Ctrl + W. I didn't know this. I just searched with Google to find the answer :-) Quote Link to comment Share on other sites More sharing options...
oded Posted May 18, 2016 Author Report Share Posted May 18, 2016 In Chrome it's Ctrl + W. I didn't know this. I just searched with Google to find the answer :-) Thank you! But I need to close a specific tab (based on it's header) (btw, in IE it's Ctrl + W too ) Quote Link to comment Share on other sites More sharing options...
Cory Posted May 18, 2016 Report Share Posted May 18, 2016 You didn't specify a specific tab. This is a typical reason why I started programming all my web automation in .NET. Too many little limitations. I can't think of any way to do it without using some sort of browser automation facility. The only left field thing I could think of was that in the early days you could disable tabs in your browser and have them all individual windows. If you did that MEP could see the window titles. But I don' think that's what you want. Quote Link to comment Share on other sites More sharing options...
rberq Posted May 18, 2016 Report Share Posted May 18, 2016 Here's a method that's a little crude, but it worked when I tested it in Firefox and Chrome. IF you know the tab title, you can treat it like a window title. Let's say the tab title you want to close contains the words "real estate". Your macro can mouse-click sequentially on each tab at the top of the screen, moving left to right, to highlight each tab. Then after each click, say If Window Title "real estate" is on top Text Type: <CTRLD>w<CTRLU> End If You have to be careful where you click on the tab, so you won't click on the "x" that closes it. I found that clicking near the top edge worked best. Also, tab width will vary -- get narrower -- if you have lots of tabs open, so the increment as you click left to right has to be small enough not to jump right over a tab. This also means you may click on the same tab more than once, but if it is not the tab you want to close then the macro will just ignore it each time. I didn't test timing, so I don't know whether this will be fast enough if there are many tabs open. Also there may be a slight delay after you click and before the tab is active, so you may have to include a short delay before checking window title. Probably best to close your eyes while the macro is working so you won't be dazzled by all the tabs flashing by. Quote Link to comment Share on other sites More sharing options...
oded Posted May 18, 2016 Author Report Share Posted May 18, 2016 Thank you Cory and rberq for your help. Much appreciated Oded. Quote Link to comment Share on other sites More sharing options...
rberq Posted May 18, 2016 Report Share Posted May 18, 2016 Thank you Cory and rberq for your help. Much appreciated Well, yeah, you're welcome, but did it work? The proof of the pudding is in the eating. Quote Link to comment Share on other sites More sharing options...
oded Posted May 21, 2016 Author Report Share Posted May 21, 2016 Well, yeah, you're welcome, but did it work? The proof of the pudding is in the eating. Whenever a tab is added I check it's header and if it's the one I don't need I simply click Ctrl + W Works flawlessly 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.