Skip to main content
2 of 2
deleted 4 characters in body
Albert Retey
  • 23.6k
  • 60
  • 104

Using Notebooks in combination with Cases or Select as Istvan has suggested lets you choose all invisible notebooks. As others have mentioned in comments that will (often) include the messages notebook and of course also any other invisible notebooks.

For notebooks that already do exist you can get rid of the messages notebooks which is accessable by Notebooks["Messages"] but for the rest you would have to search for specific options and content to decide which of those are actually those you search for.

If you do have control about how those notebooks are created, it probably is a good idea to "tag" those notebooks that you potentially need to access later. You could use the WindowTitle option for this, but there is also the special option TaggingRules which can be used to attach arbitrary information in form of rules to a notebook. To access these you can use Options, but the function CurrentValue is more comfortable for that. Here is what I would do:

Create invisible notebook with a special mark, the string "Temporary" is arbitrarily chosen, you could use whatever you want for it:

CreateDocument[{}, Visible -> False, TaggingRules -> {"Temporary" -> True}]

then select exactly those notebooks which are tagged as "Temporary":

Select[Notebooks[], TrueQ[CurrentValue[#, {TaggingRules, "Temporary"}]] &]

of course you can combine that with checking the Visible option, but probably that isn't even necessary then...

Albert Retey
  • 23.6k
  • 60
  • 104