https://www.scriptkit.com/ []Script Kit Logo Script Kit by John Lindquist Open main menu Community ScriptsDocsGuideDiscussBlog Shortcut to Everything An open-source kit to optimize your developer workflow script kit [ ] Script Kit API Guide Community * App Launcher Search for an app then launch it * Book Search Use Open Library API to search for books * Center App Center the frontmost app * Giphy Search giphy. Paste link. * Resize an Image Select an image in Finder. Type option + i to resize it. * Reddit Browse Reddit from Script Kit // Menu: App Launcher // Description: Search for an app then launch it // Author: John Lindquist // Twitter: @johnlindquist let createChoices = async () => { let apps = await fileSearch("", { onlyin: "/", kind: "application", }) let prefs = await fileSearch("", { onlyin: "/", kind: "preferences", }) let group = path => apps => apps .filter(app => app.match(path)) .sort((a, b) => { let aName = a.replace(/.*\//, "") let bName = b.replace(/.*\//, "") return aName > bName ? 1 : aName < bName ? -1 : 0 }) return [ ...group(/^\/Applications\/(?!Utilities)/)(apps), ...group(/\.prefPane$/)(prefs), ...group(/^\/Applications\/Utilities/)(apps), ...group(/System/)(apps), ...group(/Users/)(apps), ].map(value => { return { name: value.split("/").pop().replace(".app", ""), value, description: value, } }) } let appsDb = await db("apps", async () => ({ choices: await createChoices(), })) let app = await arg("Select app:", appsDb.choices) let command = `open -a "${app}"` if (app.endsWith(".prefPane")) { command = `open ${app}` } exec(command) Download Script Kit: MacOS Intel Apple Sillicon Windows Preview (Alpha) Script Kit is made for developers who understand the inherent risks of running scripts on their computer. If you're uncomfortable with any aspect of writing, running, or sharing scripts, please ask for help! Script Kit doesn't collect any personal information. Script Kit Showcase for Optimizing Your Everyday Workflows video course Script Kit Showcase for Optimizing Your Everyday Workflows - by John Lindquist Get Up and Running with Script Kit - 9 lessons24m * Write a Script with Script Kit to Browse Hacker News 4m * Instantly Launch Chrome Dev Tools with Script Kit 1m * Control Chrome From Script Kit using Apple Events 2m * Manipulate Images With Drag and Drop in Script Kit 2m * List and Launch Dev Projects with Script Kit 1m * Apply Title Case to Text Anywhere Using Script Kit 1m * Save Chrome Tabs in a Markdown File and Take Notes with Script Kit 2m * Scrape a Website on a Schedule with Script Kit 3m * Build a Multi-Tab Todos App in Script Kit 4m What is Script Kit? How often do you avoid scripting something because it takes too much effort? Script Kit makes it easy to create and run scripts that solve your daily problems. Create a new script from the prompt then your script opens in the editor of your choice. Write a few lines of JavaScript. Then run the script from the prompt. Simply put, Script Kit helps you script away the friction of your day. Key Features * #[?]Launch the prompt from anywhere as part of your flow * #[?]Add keyboard shortcuts with comments://Shortcut: opt a * #[?]Prompt for input with:await arg("First name") * #[?]Prompt for environment vars:await env("GITHUB_TOKEN") * #[?]Load npm libraries:await npm("sharp") * #[?]Share scripts directly from the prompt * #[?]Launch scripts from a Stream Deck button * #[?]Scripts behave the same in your terminal Learn more Script Kit includes a built-in tutorial and myriad examples are available on our discussions pages: * #[?]-Community examples * #[?]-Quick orientation guide * #[?]-Watch livestreams building Script Kit * #[?]-Announcements * #[?]-Ask a question Join the Script Kit community and stay up-to-date on the latest updates! [ ][ ]Subscribe No spam. We respect your privacy. Unsubscribe at any time. What the community is saying Kent C. Dodds Kent C. Dodds@kentcdodds I forgot that a lot of people don't know what @scriptkitapp is. You're missing out! I use it to easily open projects in VSCode, start a zoom meeting and put the link in my clipboard, download Twitter images, upload images to cloudinary, and so much more! Matt Pocock Matt Pocock@mattpocockuk So, @scriptkitapp is AMAZING. Just spent a very happy morning figuring out a script where it takes my latest recording from OBS and trims the silence from the start and end with ffmpeg. Now, it's just a command palette action away. Erik Rasmussen Erik Rasmussen@erikras I just learned about ScriptKit, and my mind is racing with all the stuff I could do with it. Tom Slutsky Tom Slutsky@SlutskyTom @scriptkitapp is dope! Took me less then a minute to create a command palette script for killing a port Featured Scripts app-launcher by John Lindquist Search for an app then launch it InstallAdd to Kit.app // Menu: App Launcher // Description: Search for an app then launch it // Author: John Lindquist // Twitter: @johnlindquist let createChoices = async () => { let apps = await fileSearch("", { onlyin: "/", kind: "application", }) let prefs = await fileSearch("", { onlyin: "/", kind: "preferences", }) let group = path => apps => apps .filter(app => app.match(path)) .sort((a, b) => { let aName = a.replace(/.*\//, "") let bName = b.replace(/.*\//, "") return aName > bName ? 1 : aName < bName ? -1 : 0 }) return [ ...group(/^\/Applications\/(?!Utilities)/)(apps), ...group(/\.prefPane$/)(prefs), ...group(/^\/Applications\/Utilities/)(apps), ...group(/System/)(apps), ...group(/Users/)(apps), ].map(value => { return { name: value.split("/").pop().replace(".app", ""), value, description: value, } }) } let appsDb = await db("apps", async () => ({ choices: await createChoices(), })) let app = await arg("Select app:", appsDb.choices) let command = `open -a "${app}"` if (app.endsWith(".prefPane")) { command = `open ${app}` } exec(command) book-search by John Lindquist Use Open Library API to search for books InstallAdd to Kit.app // Menu: Book Search // Description: Use Open Library API to search for books // Author: John Lindquist // Twitter: @johnlindquist let query = await arg('Search for a book title:') //This API can be a little slow. Wait a couple seconds let response = await get(`http://openlibrary.org/search.json?q=${ query}`) let transform = ({title, author_name}) => `* "${title}" - ${author_name?.length && author_name[0]}` let markdown = response.data.docs.map(transform).join('\n') inspect(markdown, 'md') center-app by John Lindquist Center the frontmost app InstallAdd to Kit.app // Menu: Center App // Description: Center the frontmost app // Author: John Lindquist // Twitter: @johnlindquist let { workArea, bounds } = await getActiveScreen() let { width, height } = workArea let { x, y } = bounds let padding = 100 let top = y + padding let left = x + padding let right = x + width - padding let bottom = y + height - padding setActiveAppBounds({ top, left, right, bottom, }) giphy-search by John Lindquist Search giphy. Paste link. InstallAdd to Kit.app // Menu: Giphy // Description: Search giphy. Paste link. // Author: John Lindquist // Twitter: @johnlindquist let download = await npm("image-downloader") let queryString = await npm("query-string") let GIPHY_API_KEY = await env("GIPHY_API_KEY", { hint: md( `Get a [Giphy API Key](https://developers.giphy.com/dashboard/)` ), ignoreBlur: true, secret: true, }) let search = q => `https://api.giphy.com/v1/gifs/search?api_key=${GIPHY_API_KEY}&q=${q} &limit=10&offset=0&rating=g&lang=en` let { input, url } = await arg( "Search giphy:", async input => { if (!input) return [] let query = search(input) let { data } = await get(query) return data.data.map(gif => { return { name: gif.title.trim() || gif.slug, value: { input, url: gif.images.original.url, }, preview: ``, } }) } ) let formattedLink = await arg("Format to paste", [ { name: "URL Only", value: url, }, { name: "Markdown Image Link", value: `![${input}](${url})`, }, { name: "HTML ", value: `${input}`, }, ]) setSelectedText(formattedLink) image-resize by John Lindquist Select an image in Finder. Type option + i to resize it. InstallAdd to Kit.app // Menu: Resize an Image // Description: Select an image in Finder. Type option + i to resize it. // Author: John Lindquist // Twitter: @johnlindquist // Shortcut: opt i let sharp = await npm("sharp") let imagePath = await getSelectedFile() let width = Number(await arg("Enter width:")) let metadata = await sharp(imagePath).metadata() let newHeight = Math.floor( metadata.height * (width / metadata.width) ) let lastDot = /.(?!.*\.)/ let resizedImageName = imagePath.replace( lastDot, `-${width}.` ) await sharp(imagePath) .resize(width, newHeight) .toFile(resizedImageName) reddit by John Lindquist Browse Reddit from Script Kit InstallAdd to Kit.app // Menu: Reddit // Description: Browse Reddit from Script Kit // Author: John Lindquist // Twitter: @johnlindquist let Reddit = await npm("reddit") let envOptions = { ignoreBlur: true, hint: md( `[Create a reddit app](https://www.reddit.com/prefs/apps)` ), secret: true, } let reddit = new Reddit({ username: await env("REDDIT_USERNAME"), password: await env("REDDIT_PASSWORD"), appId: await env("REDDIT_APP_ID", envOptions), appSecret: await env("REDDIT_APP_SECRET", envOptions), userAgent: `ScriptKit/1.0.0 (https://scriptkit.com)`, }) let subreddits = [ "funny", "aww", "dataisbeautiful", "mildlyinteresting", "RocketLeague", ] subreddits.forEach(sub => { onTab(sub, async () => { let url = await arg( "Select post to open:", async () => { let best = await reddit.get(`/r/${sub}/hot`) return best.data.children.map(({ data }) => { let { title, thumbnail, url, subreddit_name_prefixed, preview, } = data let resolutions = preview?.images?.[0]?.resolutions let previewImage = resolutions?.[resolutions?.length - 1]?.url return { name: title, description: subreddit_name_prefixed, value: url, img: thumbnail, ...(previewImage && { preview: md(` ![${title}](${previewImage}) ### ${title} `), }), } }) } ) exec(`open "${url}"`) }) }) created by John Lindquist GitHub