Skip to content

Instantly share code, notes, and snippets.

@Ptujec
Last active June 5, 2025 07:19
Show Gist options
  • Save Ptujec/725b2f2239a608ec2e1e67096965e896 to your computer and use it in GitHub Desktop.
Save Ptujec/725b2f2239a608ec2e1e67096965e896 to your computer and use it in GitHub Desktop.
My Snippets for LaunchBar Actions in VS Code & Cursor
{
// LaunchBar Snippets
"LaunchBar log": {
"prefix": "lLog",
"body": "LaunchBar.log($1)",
"description": "LaunchBar log snippet"
},
"LaunchBar alert": {
"prefix": "lAlert",
"body": "LaunchBar.alert($1)",
"description": "LaunchBar alert snippet"
},
"LaunchBar alert with response": {
"prefix": "lAlertResponse",
"body": [
"const response = LaunchBar.alert(",
" '${1:title}',",
" '${2:subtitle}',",
" '${3:Ok}',",
" '${4:Cancel}',",
");",
" switch (response) {",
" case 0:",
" // Ok … do something",
" $5",
" case 1:",
" break;",
"}"
],
"description": "LaunchBar alert with response snippet"
},
"LaunchBar paste": {
"prefix": "lPaste",
"body": "LaunchBar.paste($1)",
"description": "LaunchBar paste snippet"
},
"LaunchBar getClipboardString": {
"prefix": "lGetClipboardString",
"body": "LaunchBar.getClipboardString($1)",
"description": "LaunchBar getClipboardString snippet"
},
"LaunchBar setClipboardString": {
"prefix": "lSetClipboardString",
"body": "LaunchBar.setClipboardString($1)",
"description": "LaunchBar setClipboardString snippet"
},
"LaunchBar clearClipboard": {
"prefix": "lClearClipboard",
"body": "LaunchBar.clearClipboard()",
"description": "LaunchBar clearClipboard"
},
"LaunchBar displayNotification": {
"prefix": "lNotification",
"body": [
"LaunchBar.displayNotification({",
" title: $1,",
" string: $2,",
" url: $3",
"});"
],
"description": "LaunchBar Notification snippet"
},
"LaunchBar displayInLargeType": {
"prefix": "lLargeType",
"body": [
"LaunchBar.displayInLargeType({",
" title: $1,",
" string: $2,",
" sound: 'Purr'",
"});"
],
"description": "LaunchBar Large Type snippet"
},
"LaunchBar openURL": {
"prefix": "lOpenURL",
"body": ["LaunchBar.openURL($1)"],
"description": "LaunchBar Open URL snippet"
},
"LaunchBar testJSON": {
"prefix": "lTestJSON",
"body": ["File.writeJSON(${1:data}, `${Action.supportPath}/test.json`)"],
"description": "LaunchBar Write JSON snippet with for testing"
},
"LaunchBar hide": {
"prefix": "lHide",
"body": ["LaunchBar.hide()"],
"description": "LaunchBar Hide snippet"
},
"LaunchBar performAction": {
"prefix": "lPerformAction",
"body": ["LaunchBar.performAction(${1:actionName}, ${2:argument})"],
"description": "LaunchBar performAction snippet"
},
"LaunchBar execute": {
"prefix": "lExecute",
"body": ["LaunchBar.execute('${1:/bin/bash}', '$2')"],
"description": "LaunchBar execute (returns string)"
},
"LaunchBar executeAppleScriptFile": {
"prefix": "lASF",
"body": ["LaunchBar.executeAppleScriptFile('.${2:/}', ${3:argument})"],
"description": "LaunchBar executeAppleScriptFile (returns string)"
},
"LaunchBar executeAppleScript": {
"prefix": "lAS",
"body": [
"LaunchBar.executeAppleScript(`",
" tell application \"${1:System Events}\"",
" ${2:-- do something}",
" end tell",
" `);"
],
"description": "LaunchBar executeAppleScript (returns string)"
},
"LaunchBar formatDate": {
"prefix": "lFormatDate",
"body": [
"LaunchBar.formatDate(new Date($1), {",
" relativeDateFormatting: ${2:true},",
" timeStyle: '${3:short}',",
" dateStyle: '${4:full}'",
"});"
],
"description": "LaunchBar formatDate snippet"
},
"LaunchBar Key Options": {
"prefix": "lKeyOptions",
"body": [
"LaunchBar.options.${1|shiftKey,controlKey,commandKey,alternateKey,spaceKey|}"
],
"description": "If-Statement with LaunchBar Key Options"
},
"LaunchBar Action Prefs": {
"prefix": "lPrefs",
"body": ["Action.preferences.$1"],
"description": "LaunchBar Action Prefs snippet"
},
"LaunchBar Stringify Log ": {
"prefix": "lStringify",
"body": ["LaunchBar.log(JSON.stringify($1))"],
"description": "LaunchBar Stringify Log"
},
// LaunchBar HTTP
"LaunchBar HTTP loadRequest": {
"prefix": "lLoadRequest",
"body": [
"HTTP.loadRequest(${1:url}, {",
" timeout: 5.0,",
" method: 'GET',",
" resultType: 'text',",
"}).data;"
],
"description": "LaunchBar HTTP loadRequest"
},
"LaunchBar HTTP getJSON": {
"prefix": "lGJSON",
"body": [
"HTTP.getJSON('${1:https://api.esv.org/v3/passage/text/?q=}' + encodeURI(${2:argument}), {",
" headerFields: {",
" 'Authorization': 'Token ' + ${3:apiToken}",
" }",
"});"
],
"description": "LaunchBar HTTP getJSON"
},
"LaunchBar HTTP postJSON": {
"prefix": "lPJSON",
"body": [
"HTTP.postJSON('${1:https://httpbin.org/post}', {",
" body: {",
" $2",
" }",
"});"
],
"description": "LaunchBar HTTP postJSON"
},
"LaunchBar HTTP PUT Request": {
"prefix": "lput",
"body": [
"HTTP.createRequest('${1:putURL}', {",
" method: 'PUT',",
" body: {",
" $2",
" },",
" bodyType: 'json'",
"});",
"const putAnswer = HTTP.loadRequest(req);"
],
"description": "LaunchBar HTTP Put Request"
},
// LaunchBar File
"LaunchBar Get Directory Contents": {
"prefix": "lGetDirectoryContents",
"body": [
"File.getDirectoryContents('${1:/Applications/}', {",
" includeHidden: false,",
"});"
],
"description": "LaunchBar Get Directory Contents"
},
"LaunchBar File exists": {
"prefix": "lFileExists",
"body": ["File.exists($1)"],
"description": "LaunchBar File exists"
},
"LaunchBar File isDirectory": {
"prefix": "lFileIsDirectory",
"body": ["File.isDirectory($1)"],
"description": "LaunchBar File isDirectory"
},
"LaunchBar File displayName": {
"prefix": "lFileDisplayName",
"body": ["File.displayName($1)"],
"description": "LaunchBar File displayName"
},
"LaunchBar File bundleIdentifier": {
"prefix": "lFileBundleIdentifier",
"body": ["File.bundleIdentifier($1)"],
"description": "LaunchBar File bundleIdentifier"
},
"LaunchBar File modificationDate": {
"prefix": "lFileModificationDate",
"body": ["File.modificationDate($1)"],
"description": "LaunchBar File modificationDate"
},
"LaunchBar File creationDate": {
"prefix": "lFileCreationDate",
"body": ["File.creationDate($1)"],
"description": "LaunchBar File creationDate"
},
"LaunchBar File fileURLForPath": {
"prefix": "lFileURLForPath",
"body": ["File.fileURLForPath($1)"],
"description": "LaunchBar File fileURLForPath"
},
"LaunchBar File pathForFileURL": {
"prefix": "lPathForFileURL",
"body": ["File.pathForFileURL($1)"],
"description": "LaunchBar File pathForFileURL"
},
"LaunchBar File absolutePath": {
"prefix": "lAbsolutePath",
"body": ["File.pathForFileURL(File.fileURLForPath('${1:~}'))"],
"description": "LaunchBar File absolutePath"
},
"LaunchBar File readPlist": {
"prefix": "lReadPlist",
"body": ["File.readPlist(${1})"],
"description": "LaunchBar File readPlist"
},
"LaunchBar File readJSON": {
"prefix": "lReadJSON",
"body": ["File.readJSON(${1})"],
"description": "LaunchBar File readJSON"
},
"LaunchBar File readText": {
"prefix": "lReadText",
"body": ["File.readText(${1})"],
"description": "LaunchBar File readText"
},
"LaunchBar File createDirectory": {
"prefix": "lCreateDirectory",
"body": ["File.createDirectory('${1:~/Desktop/New Directory}')"],
"description": "LaunchBar File createDirectory"
},
"LaunchBar File writeText": {
"prefix": "lWriteText",
"body": ["File.writeText(${1:text}, ${2:fileLocation})"],
"description": "LaunchBar File writeText"
},
"LaunchBar File writeJSON": {
"prefix": "lWriteJSON",
"body": ["File.writeJSON(${1:data}, ${2:fileLocation})"],
"description": "LaunchBar File writeJSON"
},
"LaunchBar File writePlist": {
"prefix": "lWritePlist",
"body": ["File.writePlist(${1:object}, ${2:fileLocation})"],
"description": "LaunchBar File writePlist"
},
// LaunchBar Properties
"LaunchBar currentLocale": {
"prefix": "currentLocale",
"body": ["LaunchBar.currentLocale"],
"description": "LaunchBar currentLocale"
},
// LaunchBar Properties
"LaunchBar homeDirectory": {
"prefix": "lHomeDirectory",
"body": ["LaunchBar.homeDirectory"],
"description": "LaunchBar homeDirectory"
},
"LaunchBar Properties Title": {
"prefix": "title",
"body": ["title"],
"description": "LaunchBar Properties Title"
},
"LaunchBar Properties Subtitle": {
"prefix": "subtitle",
"body": ["subtitle"],
"description": "LaunchBar Properties Subtitle"
},
"LaunchBar Properties Icon": {
"prefix": "icon",
"body": ["icon"],
"description": "LaunchBar Properties Icon"
},
// LaunchBar Options
"LaunchBar Options commandKey": {
"prefix": "commandKey",
"body": ["commandKey"],
"description": "LaunchBar Options commandKey"
},
"LaunchBar Options alternateKey": {
"prefix": "alternateKey",
"body": ["alternateKey"],
"description": "LaunchBar Options alternateKey"
},
"LaunchBar Options shiftKey": {
"prefix": "shiftKey",
"body": ["shiftKey"],
"description": "LaunchBar Options shiftKey"
},
"LaunchBar Options controlKey": {
"prefix": "controlKey",
"body": ["controlKey"],
"description": "LaunchBar Options controlKey"
},
"LaunchBar Options actionRunsInBackground": {
"prefix": "lactionRunsInBackground",
"body": ["actionRunsInBackground: true,"],
"description": "LaunchBar Options actionRunsInBackground"
},
"LaunchBar Options actionReturnsItems": {
"prefix": "lactionReturnsItems",
"body": ["actionReturnsItems: true,"],
"description": "LaunchBar Options actionReturnsItems"
},
"LaunchBar Options alwaysShowsSubtitle": {
"prefix": "lbalwaysShowsSubtitle",
"body": ["alwaysShowsSubtitle: true,"],
"description": "LaunchBar Options alwaysShowsSubtitle"
},
// LaunchBar String Additions Methods
"LaunchBar String Localize": {
"prefix": "llocalize",
"body": ["localize()"],
"description": "LaunchBar String Localize"
},
"LaunchBar String Localization Table": {
"prefix": "llocalizationTable",
"body": ["String.prototype.localizationTable = '${1:default}'"],
"description": "LaunchBar String Localization Table"
},
"LaunchBar String toBase64Data": {
"prefix": "ltoBase64Data",
"body": ["toBase64Data($1)"],
"description": "LaunchBar String toBase64Data"
},
"LaunchBar String toBase64String": {
"prefix": "ltoBase64String",
"body": ["toBase64String($1)"],
"description": "LaunchBar String toBase64String"
},
"LaunchBar String toData": {
"prefix": "ltoData",
"body": ["toData($1)"],
"description": "LaunchBar String toData"
},
"LaunchBar String toDataFromBase64String": {
"prefix": "ltoDataFromBase64String",
"body": ["toDataFromBase64String($1)"],
"description": "LaunchBar String toDataFromBase64String"
},
"LaunchBar String toStringFromBase64String": {
"prefix": "ltoStringFromBase64String",
"body": [
"toStringFromBase64String({",
" encoding: '${1:utf-8}',",
" ignoreUnknownCharacters: ${2:false}",
"})"
],
"description": "LaunchBar String toStringFromBase64String"
},
"LaunchBar String decodeHTMLEntities": {
"prefix": "ldecodeHTMLEntities",
"body": ["decodeHTMLEntities()"],
"description": "LaunchBar String decodeHTMLEntities"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment