Feature Request: Data Export from Binary Template

Hello everybody,
as a regular user of 010 editor and author of some binary templates (two in the repo, a third following) i had an idea for a feature which i want to discuss.
It would be a great help if one could export the data structure from a binary template.
I am working on a Retrodrive template. It can parse old floppy images (like CP/M or FLEX and FDOS for now). I was thinking it would be nice if one could highlight a file for example and then export the user data to a file. It would make a some tools unnecessary. The “Save Selection” Menu is already there. A Multi Selection of Datablocks in the Template Results Window would need to be there, and then a Contextmenu which calls a “special” function in the script with the selected datapointer.
Or something like that.
Please tell me what you think.


Hello Robert. Are you just looking to write various blocks of data from a data file to a separate file? If the blocks are all contiguous then you might be able to use the ‘Selection > Mark Selection Start’ and ‘Selection > Mark Selection End’ functions on the right-click menu, and then ‘Save Selection’. If the blocks are not contiguous then you would probably have to use a script to save the blocks and we could give some examples on how to do this. We are planning on adding multi-select in the Template results but that is not available right now. Let us know if you need any more information.

SweetScape Software

Thank you for your reply.
Unfortunately the blocks are non-continuous. I would like an example of a script which could do that. I don’t have experience with scripts, but it looks like a promising solution. Is there a connection with the binary template or does the script run completely independent?
Can i at least run a script from the template to have access to the variables? It would be twice the work if this wouldn’t be possible.


Here is a short script that demonstrates how to write data from some variables to a separate file:

int curFile = GetFileNum();
int exportFile = FileNew( "Hex" ); 
FileSelect( curFile );

void ExportVariable( int64 start, int64 size )
    SetSelection( start, size );
    FileSelect( exportFile );
    SetSelection( 0, 0 );
    SetCursorPos( FileSize() );
    FileSelect( curFile );

ExportVariable( startof(record[0]), sizeof(record[0]) );
ExportVariable( startof(dirEntry[1]), sizeof(dirEntry[2]) );

In this example, record[0] and dirEntry[1] are the variables that are exported. The script can automatically access these variables as long as the template is run on the file first. You also have to make sure that you are running the script on the data file and let us know if you have any trouble getting this to work.

SweetScape Software

Thank you for the example. I wrote two scripts to export the data from Imagedisk and Samdisk Imagefiles and submitted everything to the Repos.