Created
          October 26, 2022 16:06 
        
      - 
      
 - 
        
Save tayiorbeii/4d09d1f4263a235351cd1c15e8343592 to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | import "@johnlindquist/kit" | |
| // Author: Taylor Bell | |
| // Name: search by filename | |
| // Shortcut: opt+f | |
| // Description: Select files in Finder that contain a substring | |
| let name = await arg() | |
| 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" | |
| tell application id "com.apple.SystemEvents" to tell the ¬ | |
| folder named folderpath to tell (every file whose ¬ | |
| name contains "${name}") to set filepaths to its path | |
| tell application id "com.apple.Finder" | |
| reveal the filepaths | |
| 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