Essentials
Display HTML and MarkdownText InputSelect a PathBuilt-in EditorBuilt-in TerminalEnvironment VariablesDevToolsnpm PackagesShare ScriptsAdvanced
Run From the TerminalDisplay HTML and Markdown
Display HTML
Use await div('')
to display HTML.
Open display-html in Script Kit
Display HTML with CSS
Script Kit bundles Tailwind CSS.
Open display-html-with-css in Script Kit
Display Markdown
The md()
function will convert Markdown to HTML into HTML that you can pass into div. It will also add the default Tailwind styles so you won't have to think about formatting.
Open display-markdown in Script Kit
Text Input
Input Text with await arg()
The simplest form of input you can accept from a user is an arg()
Select From a List of Strings
Open select-from-a-list in Script Kit
Select From a List of Objects
Open select-from-a-list-of-objects in Script Kit
Display a Preview When Focusing a Choice
Open display-a-preview-when-focusing-a-choice in Script Kit
Select a Path
Select a Path
Open select-a-path in Script Kit
Select a Path with Options
Open select-a-path-with-options in Script Kit
Drag and Drop
Open drop-example in Script Kit
Select from Finder Prompts
Open select-from-finder-prompt in Script Kit
Built-in Editor
Built-in Editor
Open editor-example in Script Kit
Load Text in the Editor
Open load-text-into-the-editor in Script Kit
Built-in Terminal
Use the Built-in Terminal
Open run-commands-in-the-terminal in Script Kit
The shell defaults to
zsh
. You can change your shell by setting theKIT_SHELL
environment variable in the ~/kenv/.env, but most of the testing has been done withzsh
.
Environment Variables
Read and Write from ~/.kenv/.env
The env
helper will read environment variables from ~/.kenv/.env. If the variable doesn't exist, it will prompt you to create it.
Open env-example in Script Kit
Choose an Environment Variable
If you pass a function as the second argument to env
, it will only be called if the variable doesn't exist.
This allows you to set Enviroment Variables from a list, an API, or any other data source.
Open choose-an-environment-variable in Script Kit
DevTools
Play with Data in Chrome DevTools
Open play-with-data-in-chrome-devtools in Script Kit
npm Packages
Install Express from npm
Open express-example in Script Kit
You can terminate a long-running process like above from the menubar dropdown menu or by pressing
cmd+p
from the Script Kit window to list running processes.
Share Scripts
Get Featured
Featured scripts are displayed in:
- The
hot
tab of the Script Kit main window - On the Community Scripts page
To get featured, post your script to the Script Kit Github discussions Share page. With a script focused in the Script Kit main window, you can press right or cmd+k to bring up a share menu which will automatically walk you through creating a shareable post for the script.
As a shortcut, hit cmd+s with a script selected to automatically run the "Share as Discussion" process.
Share as a Gist, Link, URL, or Markdown
The Script Kit main window also includes many other share options:
- Share as Gist cmd+g: Creates as Gist of the selected script, then copies the URL to the clipboard
- Share as Link opt+s: Creates a private installable kit://link to the selected script, then copies the URL to the clipboard. These links are very long as they encode the entire script into the URL.
- Share as URL opt+u: Creates a Gist of the selected script, then copies an installable public URL to the clipboard
- Share as Markdown cmd+m: Copies the selected script as a Markdown snippet to the clipboard
Add a Keyboard Shortcut
// Shortcut Metadata
Use the // Shortcut
metadata to add a global keyboard shortcut to any script
// Shortcode Metadata
A shortcode allows you quickly run a script without needing to search for it.
To trigger a // Shortcode
, type the string of characters from the main menu, then hit spacebar
. In this example, you would type oi
then spacebar
to run this script:
Quick Submit from Hint
A common pattern from Terminal is to quickly submit a script from a hint. Using a bracket around a single character will submit that character when pressed.
Quick Submit from Choice
If you need to provide a little more information to the user, use a choice instead of a hint. This allows you to provide a full value that will be submitted instead of just the single letter.
Run a Script on a Schedule
Run a Script on a Schedule
Use cron syntax to run scripts on a schedule. The following example will show a notification to stand up and stretch every 15 minutes.
Open stand-up-and-stretch in Script Kit
Crontab.guru is a great utility to help generate and understand cron syntax.
Watch for File Changes
Watch a Single File
The // Watch
metadata enables you to watch for changes to a file on your system.
Watch a Directory
The // Watch
metadata uses Chokidar under the hood, so it supports the same glob patterns.
Open download-log in Script Kit
Create Files
Create a Text File
Open create-a-text-file in Script Kit
Update a Text File
Open update-a-text-file in Script Kit
Download Files
Download a Single File
Open download-a-file in Script Kit
Get, Post, Put, Delete Requests
The get
, post
, put
, and delete
methods use the axios API
Make a Get Request
Open get-example in Script Kit
Make a Post Request
Open post-example in Script Kit
Simple Storage
Read and Write Using the db
Helper
The db
helpers reads/writes to json files in the ~/.kenv/db
directory. It's meant as a simple wrapper around common json operations.