Selectandcut

Posted by jbwhaley, Last update 12 days ago

Selects the current line and cuts it to the clipboard. Best used in a custom keyboard.

Steps

  • script

    // Grab current line and send to the system clipboard
    var range = editor.getSelectedLineRange();
    editor.setSelectedRange(range[0],range[1]-1);
    var clip = editor.getSelectedText();
    app.setClipboard(clip);
    
    // Remove current line from draft
    editor.setSelectedRange(range[0],range[1]);
    var cut = editor.getSelectedText();
    editor.setSelectedText('');
    
    // Set cursor position to end of previous line
    editor.setSelectedRange(range[0]-1);

Options

  • After Success Nothing
    Notification Error
    Log Level Info
Actions available in the Action Directory are uploaded by community members. Use appropriate caution reviewing downloaded actions before use.