Duration
1 min
Access
Free
Transcript
Available

Sometimes you just want to select and modify some text you have written somewhere on your system. To help you with this, Script Kit provides a getSelectedText and setSelectedText. Between these two helpers, your script and use and/or modify the text however you want.

Applying an npm tool like title-case can help when you're not entirely sure when certain words need to be capitalized. In fact, I used the title case script on the title of this lesson!

Install title-case

// Name: Title Case

import "@johnlindquist/kit"

let { titleCase } = await npm("title-case")

let selectedText = await getSelectedText()
let titleText = titleCase(selectedText)

await setSelectedText(titleText)

// This Is the Title of My Next Blog Post