Use this code, e.g. next to the tower fortress building (even I think it crashes the game everywhere).
_nul = [[nearestBuilding getposATL thistrigger]] execVM "copyclass.sqf";
Copyclass.sqf:
private ["_array","_unit"];
_array = _this select 0;
_unit = [];
{_unit = _unit + [typeof _x];} foreach _array;
copyToClipboard format["%1",_unit];
hint "Classes copied!";