Close All But This

Developer
Feb 21, 2009 at 12:30 PM
I want to be able to close all the tabs in the ISE editor except the one I am currently in.

I have looked at the objects on $psISE and don't see a Close() method but do see a DisplayName.

Anyone know how to do this?

Thanks
Developer
Feb 26, 2009 at 6:23 AM
I think the best way is to send a suggestion to connect.microsoft.com. Even if there where work arounds, the object model would be incomplete. I'm just missing a function to determine whether a shortcut is already in use.
Developer
Feb 26, 2009 at 10:15 AM
Editor.focus() does not switch the tab. Something that switches to a specific tab is needed too.
Developer
Feb 27, 2009 at 8:12 PM
Edited Feb 27, 2009 at 8:13 PM
The basic methods are
$psIse.CurrentOpenedRunspace.OpenedFiles.Remove( $openFile) 
and
$psIse.CurrentOpenedRunspace.OpenedFiles.RemoveUnsaved($openFile).
I have allready a function to close the current editor or any editor specified by an index. I hope to add a switch tomorrow to close all but the current or any specified editor tab tomorrow.
To find the undokumented functions:
$psIse.CurrentOpenedRunspace.OpenedFiles.PSBase | gm
Bernd




Developer
Feb 28, 2009 at 12:09 PM
Edited Feb 28, 2009 at 12:09 PM
Hello Doug, just added Close-ISETab. Your Problem is solved.
Developer
Feb 28, 2009 at 12:20 PM
Thanks Bernd. I'll give it a try.

I'll also post a suggestion on connect.