Skip to content

Instantly share code, notes, and snippets.

@tayiorbeii
Created May 12, 2023 16:43
Show Gist options
  • Save tayiorbeii/4945377c75fa75fbc848e140c46c64a3 to your computer and use it in GitHub Desktop.
Save tayiorbeii/4945377c75fa75fbc848e140c46c64a3 to your computer and use it in GitHub Desktop.
import "@johnlindquist/kit"
// Author: Taylor Bell
// Name:
// Shortcut:
// Description: Select transcripts and image folders in the current Finder window
await applescript(`
set folderpath to false
tell application id "com.apple.Finder" to tell (a reference to the ¬
front Finder window) to if it exists then tell its target as ¬
alias to set folderpath to its POSIX path
if folderpath = false then set folderpath to "~/Desktop"
set mdFiles to {}
set txtFiles to {}
set imageDirs to {}
tell application id "com.apple.SystemEvents" to tell the ¬
folder named folderpath
set mdFiles to (every file whose ¬
name ends with "-transcript.md")'s path
set txtFiles to (every file whose ¬
name ends with "-transcript.txt")'s path
set imageDirs to (every folder whose ¬
name begins with "images-")'s path
end tell
set allPaths to mdFiles & txtFiles & imageDirs
tell application id "com.apple.Finder"
reveal the allPaths
activate
return the selection as alias list
end tell
`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment