Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #23439
    LTT
    Participant

    Please consider making SeparatedValues (CSV delimiters) editable via macros (e.g. splitting the data so that WriteProfileInt/WriteProfileString can be used).

    An example of use:
    I select a string in the text and run a macro.
    The macro will add the string as a delimiter (by changing one of the 8 units) and then switch the view with it.
    Later when I want to use another string, I just select the new string and run the macro again.
    The macro will change the delimiter and switch the view again.

    Reason (1):
    CSV mode often makes the view dramatically clear and easy to edit, even when the document is not any CSV type. We can align the text with any string (and then we can sort the text by that column. etc.).
    Sometimes I need to switch to different delimiters to align the different part of the text.
    But currently adding/changing a delimiter is not an enjoyable job. This is the main reason.
    And since these are just temporary delimiters, I don’t really want to keep them for long in the settings.

    If the macro methods can be used, adding/changing a delimiter would be very fast. And in most cases only one of the 8 units is needed for the macro to switch different temporary delimiters.

    Reason (2):
    The 8 units can be fully customized. Users’ settings could be totally different from each other. So using “Switch/Convert to CSV (multiple items)” commands (IDs: 22528/22656 + 7) in macros makes little sense if we have no way to set/change the corresponding delimiters, which hinders the users from sharing CSV-related macros.

    Alternative idea:
    If separatedValues has been an unchangeable fait accompli, is it possible to add one extra set of data for macro to use?

    #26235
    LTT
    Participant

    Still hope this suggestion will be considered.

    #26239
    Yutaka Emura
    Keymaster

    I will seriously think about that in future versions.
    Thank you.

    #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,

    #26374
    LTT
    Participant

    Thank you for the great enhancement.
    Works very well so far as I’ve tested.

    A display issue:
    Switch to a CSV format whose Delimiter is more than 1 character.
    ** If the window is not wide enough, the delimiter in the view “changes” to the 1st character with a newline mark. **

    Suggestions for CSV toolbar:
    Besides the macro Remove method, add a “Remove” menu item for the format buttons.
    + Option: Add rows when not fit. (And hope Markers and other toolbars will also have this option.)

    #26375
    Yutaka Emura
    Keymaster

    Hello,
    I am glad that it works.

    >Besides the macro Remove method, add a “Remove” menu item for the format buttons.

    Exactly where are the format buttons?

    #26380
    LTT
    Participant

    The buttons (to switch the different CSV modes) in the CSV/Sort toolbar.
    The suggestions are for the toolbar(s).

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.