//-----------Функция получения типа объекта в InDesign--------------------------
//-------------------Подарена Богданом bogv-------------------------------------
function GetTypeName(InDesInterface: IDispatch): string;
var PointerToTypeInformation: ^ITypeInfo;
TypeInfo: ITypeInfo;
InDesLib: ITypeLib;
PointerToTypeString: PWideString;
TypeString: WideString;
IndexOfInterface: integer;
TemporaryResult: string;
begin
InDesInterface.GetTypeInfo(0,0,PointerToTypeInformation);
TypeInfo:=ITypeInfo(PointerToTypeInformation);
PointerToTypeString:=AllocMem(1000);
TypeInfo.GetContainingTypeLib(InDesLib,IndexOfInterface);
InDesLib.GetDocumentation(IndexOfInterface,PointerToTypeString,nil,nil,nil);
TypeString:=PointerToTypeString^;
TemporaryResult:=TypeString;
FreeMem(PointerToTypeString);
Result:=TemporaryResult;
end;