FWIW -
I too know of no way of doing this from LISP natively, however, the .NET API exposes the bool Layout.TabSelected Property, which could be utilized to extend LISP via custom LispFunction Method.
As a quick example, consider this pseudo-named, custom LayoutListSelected function:
Attached to this post is an Autoloader .bundle which supports 2012-2014 natively, but the ./Contents/Windows/2010/ assembly can be NETLOADed into 2010 & 2011 as well, as it has been compiled to .NET 3.5 framework (for those still using pre-Autoloader 2010 Database versions)... Simply download, unblock, and unzip to ..\ApplicationPlugins\, and start AutoCAD.
[Edit] - Autodesk forums would not allow me to upload the attached Autoloader .bundle as a .ZIP, so I've added a .TXT file extension, which seems to have worked... Simply remove this prior to unzipping.
... And for those, like me, that would prefer to compile themselves, here's the source code (C#):
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.EditorInput;
using System.Collections.Generic;
[assembly: CommandClass(typeof(BlackBox.AutoCAD.LayoutListSelected.Commands))]
namespace BlackBox.AutoCAD.LayoutListSelected
{
class Commands
{
[LispFunction("LayoutListSelected")]
public ResultBuffer LayoutListSelected(ResultBuffer args)
{
if (args != null)
throw new TooManyArgsException();
Document doc = Application.DocumentManager.MdiActiveDocument;
Database db = doc.Database;
//Editor ed = doc.Editor;
//LayoutManager layoutMgr = LayoutManager.Current;
List<string> layouts = new List<string>();
ResultBuffer res = new ResultBuffer();
using (Transaction tr = db.TransactionManager.StartTransaction())
{
DBDictionary layoutDic =
(DBDictionary)tr.GetObject(db.LayoutDictionaryId, OpenMode.ForRead, false);
foreach (DBDictionaryEntry entry in layoutDic)
{
Layout layout =
(Layout)tr.GetObject(entry.Value, OpenMode.ForRead);
string layoutName = layout.LayoutName;
if (layout.TabSelected)
layouts.Add(layoutName);
}
tr.Commit();
}
layouts.Remove("Model");
if (0 < layouts.Count)
{
layouts.Sort();
foreach (string layoutName in layouts)
{
res.Add(new TypedValue(5005, layoutName));
}
return res;
}
else
return null;
}
}
// Special thanks to Gile for his LispException classes:
class LispException : System.Exception
{
public LispException(string msg) : base(msg) { }
}
class TooFewArgsException : LispException
{
public TooFewArgsException() : base("too few arguments") { }
}
class TooManyArgsException : LispException
{
public TooManyArgsException() : base("too many arguments") { }
}
class ArgumentTypeException : LispException
{
public ArgumentTypeException(string s, TypedValue tv)
: base(string.Format(
"invalid argument type: {0}: {1}",
s, tv.TypeCode == (int)LispDataType.Nil ? "nil" : tv.Value))
{ }
}
}
"How we think determines what we do, and what we do determines what we get."