Scripts by filiptammergard

Text analyzer script

I made a little script for getting number of characters, words and estimated reading time of currently selected text. Much easier than copying something into a text editor to see these things.

// Menu: Analyze Text
// Description: Select a text and see data about it
// Author: Filip Tammergård
// Twitter: @filipang
// Shortcut: cmd opt shift control t
const { countCharacters, countWords, getReadingTime } = await npm(
const { getSelectedText } = await kit("text");
const selectedText = await getSelectedText();
const characters = countCharacters(selectedText);
const words = countWords(selectedText);
const readingTime = getReadingTime(selectedText);
const readingTimeMinutes = readingTime.minutes;
<section style="margin:10px">
<p>Characters: ${characters}</p>
<p>Words: ${words}</p>
<p>Reading time: ${readingTimeMinutes} minutes</p>

Could be extended a lot!

Is it possible to set the size of the window that pops up with show?

Discuss Post