Action

ᴀʙᴄ

Posted by @mattcassinelli, Last update over 6 years ago

Script key: Convert text to small caps.

Not my original creation – if you created it let me know!

Steps

  • script

    //based on upside down and backwards by agiletortoise
    function smallCapitalize(input) {
    var out = '';
    for( var i = 0; i <= input.length - 1; i++ ) {
    var ch = input.charAt( i );
    if( ch == 'a' || ch == 'A' ) { out += '\u1D00' }
    else if( ch == 'b' || ch == 'B' ) { out += '\u0299' }
    else if( ch == 'c' || ch == 'C' ) { out += '\u1D04' }
    else if( ch == 'd' || ch == 'D' ) { out += '\u1D05' }
    else if( ch == 'e' || ch == 'E' ) { out += '\u1D07' }
    else if( ch == 'f' || ch == 'F' ) { out += '\u0493' }
    else if( ch == 'g' || ch == 'G' ) { out += '\u0262' } 
    else if( ch == 'h' || ch == 'H' ) { out += '\u029C' }
    else if( ch == 'i' || ch == 'I' ) { out += '\u026A' }
    else if( ch == 'j' || ch == 'J' ) { out += '\u1D0A' }
    else if( ch == 'k' || ch == 'K' ) { out += '\u1D0B' }
    else if( ch == 'l' || ch == 'L' ) { out += '\u029F' }
    else if( ch == 'm' || ch == 'M' ) { out += '\u1D0D' }
    else if( ch == 'n' || ch == 'N' ) { out += '\u0274' }
    else if( ch == 'o' || ch == 'O' ) { out += '\u1D0F' }
    else if( ch == 'p' || ch == 'P' ) { out += '\u1D18' }
    else if( ch == 'q' || ch == 'Q' ) { out += '\u01EB' }
    else if( ch == 'r' || ch == 'R' ) { out += '\u0280' }
    else if( ch == 's' || ch == 'S' ) { out += 's' }
    else if( ch == 't' || ch == 'T' ) { out += '\u1D1B' }
    else if( ch == 'u' || ch == 'U' ) { out += '\u1D1C' }
    else if( ch == 'v' || ch == 'V' ) { out += '\u1D20' }
    else if( ch == 'w' || ch == 'W' ) { out += '\u1D21' }
    else if( ch == 'x' || ch == 'X' ) { out += 'x' }
    else if( ch == 'y' || ch == 'Y' ) { out += '\u028F' }
    else if( ch == 'z' || ch == 'Z' ) { out += '\u1D22' }
    else { out += ch }
    }
    return out;
    }
    
    editor.setText(smallCapitalize(editor.getText()));

Options

  • After Success Nothing
    Notification Error
    Log Level Error
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.