Re: NotebookClose
- To: mathgroup at smc.vnet.net
- Subject: [mg86592] Re: NotebookClose
- From: Albert Retey <awnl at arcor.net>
- Date: Fri, 14 Mar 2008 04:17:25 -0500 (EST)
- References: <frclsc$rpn$1@smc.vnet.net>
Hi, > I have about 30 Mathematica windows open and I would > like to close the windows with a specific title. I can > get a listing of all the notebooks by using the > command Notebooks[]. I can further get the information > for all the notebooks by > Map[NotebookInformation[#], Notebooks[]] > > This gives information such as the WindowTitle, > MemoryModificationTime and ModifiedInMemory. > I would however, like to close the notebooks that have > a WindowTitle as "temp" for example. > > Any suggestions would be great. This gives the notebooks whose title start with "temp": tempnbs = Select[ Notebooks[], StringMatchQ[ ("WindowTitle" /. NotebookInformation[#]), StartOfString ~~ "temp" ~~ ___ ] & ] this closes all of them: NotebookClose /@ tempnbs if you are courageous, do it in one step. Maybe you also want to play with the StringPattern to fit your needs... hth, albert