Action

Show 280 char Limit

Posted by Chris Grieser, Last update over 3 years ago

Puts a marker at the 280 character limit of the Draft and informs how many characters are left.

Useful for drafting tweets.

Steps

  • script

    char_limit = 280; //characterlimit of Twitter defined here
    
    //remove stop sign, in case the show-280c-limit action has already been run
    draft.content = draft.content.replaceAll ("🛑","");
    editor.load(draft);
    
    //info on length
    chars = draft.content.length;
    
    if (chars > char_limit){
    	editor.setTextInRange (char_limit, 0, "🛑");
    	excess = chars - char_limit;
    	app.displayErrorMessage(excess.toString() + " excess chars");
    } else {
    	remaining = char_limit - chars;
    	app.displayInfoMessage(remaining.toString() + " chars remaining");
    }
    
    draft.update();
    
    

Options

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