#26370
Yutaka Emura
Keymaster

v19.4.0 beta 1 (v19.3.91) enhances the macros related to CSV definitions.
You can create a temporary CSV format like this:


csvlist = editor.CsvList;
count = csvlist.Count;

if( count > 64 ) {
	alert( "Too many CSV formats defined. Please remove one CSV format to continue." );
	Quit();
}

csvlist.Add( "Temporary for macros", "," );  // add a temporary CSV to the list
count = csvlist.Count;

csv = csvlist.Item( count );  // retrieve the last (temporary) CSV

csv.EnableTitle = true;  // set optional properties as needed
csv.Title = "Temporary";
csv.AllowDelimiter = false;
csv.AllowNL = false;
csv.Escape = true;
csv.Heading = 3;
csv.MaxDetectLines = 30;
csv.MinDetectDelimiter = 2;
csv.FirstDetectLine = 2;
csv.LinesCell = 9000;

editor.CsvList = csvlist;  // save the changes

EEID_SV_MODE = 22528;
editor.ExecuteCommandByID(EEID_SV_MODE + count - 1);   // temporary CSV mode

// .... do something

EEID_MODE_NORMAL = 4472;
editor.ExecuteCommandByID(EEID_MODE_NORMAL);   // back to normal mode

csvlist.Remove( count );  // remove the temporary CSV mode when finished using it
editor.CsvList = csvlist;  // save the changes

The number of CSV formats you can define was increased to 64 from 8, but only the first 8 CSV formats can be detected automatically when opening a document.

I can still tweak macros if you let me know before the official release of v19.4, so please let me know if you have any comments.

Thanks,