# Copy types with offsets included # # Requested by a customer who wanted to be able to copy structures simila to how they are shown in the UI with hex offsets import binaryninjaui import PySide6 typeName = interaction.get_text_line_input("Type", "Type to copy:").decode('utf8') typeVar = bv.get_type_by_name(typeName) if not typeVar: # check libraries for lib in bv.type_libraries: typeVar = lib.get_named_type(typeName) if typeVar: break if typeVar: lines = "" for line in typeVar.get_lines(bv, typeName): lines += f"{hex(line.offset)} {str(line)}\n" clip = PySide6.QtGui.QGuiApplication.clipboard() clip.setText(lines) else: log_info(f"Could not find a type with the name {typeName}")