├── .gitignore ├── Open with Sublime Text 2 ├── build │ ├── Open with Sublime Text 2 in Finder.app.zip │ └── Open with Sublime Text 2 in Path Finder.app.zip └── src │ ├── open-with-sublimetext2-in-finder.scpt │ └── open-with-sublimetext2-in-pathfinder.scpt ├── Open with Sublime Text 3 ├── build │ ├── Open with Sublime Text in Finder.app.zip │ └── Open with Sublime Text in Path Finder.app.zip └── src │ ├── open-with-sublimetext-in-finder.scpt │ └── open-with-sublimetext-in-pathfinder.scpt ├── Open with iTerm ├── build │ ├── Open with iTerm in Finder.app.zip │ └── Open with iTerm in Path Finder.app.zip └── src │ ├── open-with-iterm-in-finder.scpt │ └── open-with-iterm-in-pathfinder.scpt └── readme.md /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | *.app -------------------------------------------------------------------------------- /Open with Sublime Text 2/build/Open with Sublime Text 2 in Finder.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallroot/applescript-applets/f4e2ecb9ee8488f8a2317d804268dc67a186379b/Open with Sublime Text 2/build/Open with Sublime Text 2 in Finder.app.zip -------------------------------------------------------------------------------- /Open with Sublime Text 2/build/Open with Sublime Text 2 in Path Finder.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallroot/applescript-applets/f4e2ecb9ee8488f8a2317d804268dc67a186379b/Open with Sublime Text 2/build/Open with Sublime Text 2 in Path Finder.app.zip -------------------------------------------------------------------------------- /Open with Sublime Text 2/src/open-with-sublimetext2-in-finder.scpt: -------------------------------------------------------------------------------- 1 | on getSelectedFiles() 2 | set selectedFiles to {} 3 | 4 | tell application "Finder" 5 | try 6 | set theSelection to selection as alias list 7 | on error 8 | return {} 9 | end try 10 | 11 | if theSelection is {} then 12 | set targetFolder to target of front Finder window as string 13 | 14 | if targetFolder is not "" and targetFolder is not ":" then 15 | set selectedFiles to targetFolder 16 | end if 17 | else 18 | set selectedFiles to theSelection 19 | end if 20 | end tell 21 | 22 | return selectedFiles 23 | end getSelectedFiles 24 | 25 | on openWithSublimeText(theFiles) 26 | tell application id "com.sublimetext.2" 27 | open theFiles 28 | activate 29 | end tell 30 | end openWithSublimeText 31 | 32 | on run 33 | set selectedFiles to getSelectedFiles() 34 | 35 | if selectedFiles's length is 0 then 36 | display alert "Select proper folder or file" 37 | return 38 | end if 39 | 40 | openWithSublimeText(selectedFiles) 41 | end run 42 | -------------------------------------------------------------------------------- /Open with Sublime Text 2/src/open-with-sublimetext2-in-pathfinder.scpt: -------------------------------------------------------------------------------- 1 | on getSelectedFiles() 2 | set selectedFiles to {} 3 | 4 | tell application "Path Finder" 5 | set theSelection to selection 6 | 7 | if theSelection is missing value then 8 | set targetfolder to target of first finder window 9 | 10 | if targetfolder is not missing value then 11 | copy path of targetfolder to the end of selectedFiles 12 | end if 13 | else 14 | repeat with selectedFile in theSelection 15 | copy path of selectedFile to the end of selectedFiles 16 | end repeat 17 | end if 18 | end tell 19 | 20 | return selectedFiles 21 | end getSelectedFiles 22 | 23 | on openWithSublimeText(theFiles) 24 | tell application id "com.sublimetext.2" 25 | open theFiles 26 | activate 27 | end tell 28 | end openWithSublimeText 29 | 30 | on run 31 | set selectedFiles to getSelectedFiles() 32 | 33 | if selectedFiles's length is 0 then 34 | display alert "Select proper folder or file" 35 | return 36 | end if 37 | 38 | openWithSublimeText(selectedFiles) 39 | end run 40 | -------------------------------------------------------------------------------- /Open with Sublime Text 3/build/Open with Sublime Text in Finder.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallroot/applescript-applets/f4e2ecb9ee8488f8a2317d804268dc67a186379b/Open with Sublime Text 3/build/Open with Sublime Text in Finder.app.zip -------------------------------------------------------------------------------- /Open with Sublime Text 3/build/Open with Sublime Text in Path Finder.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallroot/applescript-applets/f4e2ecb9ee8488f8a2317d804268dc67a186379b/Open with Sublime Text 3/build/Open with Sublime Text in Path Finder.app.zip -------------------------------------------------------------------------------- /Open with Sublime Text 3/src/open-with-sublimetext-in-finder.scpt: -------------------------------------------------------------------------------- 1 | on getSelectedFiles() 2 | set selectedFiles to {} 3 | 4 | tell application "Finder" 5 | try 6 | set theSelection to selection as alias list 7 | on error 8 | return {} 9 | end try 10 | 11 | if theSelection is {} then 12 | set targetFolder to target of front Finder window as string 13 | 14 | if targetFolder is not "" and targetFolder is not ":" then 15 | set selectedFiles to targetFolder 16 | end if 17 | else 18 | set selectedFiles to theSelection 19 | end if 20 | end tell 21 | 22 | return selectedFiles 23 | end getSelectedFiles 24 | 25 | on openWithSublimeText(theFiles) 26 | tell application "Sublime Text" 27 | open theFiles 28 | activate 29 | end tell 30 | end openWithSublimeText 31 | 32 | on run 33 | set selectedFiles to getSelectedFiles() 34 | 35 | if selectedFiles's length is 0 then 36 | display alert "Select proper folder or file" 37 | return 38 | end if 39 | 40 | openWithSublimeText(selectedFiles) 41 | end run 42 | -------------------------------------------------------------------------------- /Open with Sublime Text 3/src/open-with-sublimetext-in-pathfinder.scpt: -------------------------------------------------------------------------------- 1 | on getSelectedFiles() 2 | set selectedFiles to {} 3 | 4 | tell application "Path Finder" 5 | set theSelection to selection 6 | 7 | if theSelection is missing value then 8 | set targetfolder to target of first finder window 9 | 10 | if targetfolder is not missing value then 11 | copy path of targetfolder to the end of selectedFiles 12 | end if 13 | else 14 | repeat with selectedFile in theSelection 15 | copy path of selectedFile to the end of selectedFiles 16 | end repeat 17 | end if 18 | end tell 19 | 20 | return selectedFiles 21 | end getSelectedFiles 22 | 23 | on openWithSublimeText(theFiles) 24 | tell application "Sublime Text" 25 | open theFiles 26 | activate 27 | end tell 28 | end openWithSublimeText 29 | 30 | on run 31 | set selectedFiles to getSelectedFiles() 32 | 33 | if selectedFiles's length is 0 then 34 | display alert "Select proper folder or file" 35 | return 36 | end if 37 | 38 | openWithSublimeText(selectedFiles) 39 | end run 40 | -------------------------------------------------------------------------------- /Open with iTerm/build/Open with iTerm in Finder.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallroot/applescript-applets/f4e2ecb9ee8488f8a2317d804268dc67a186379b/Open with iTerm/build/Open with iTerm in Finder.app.zip -------------------------------------------------------------------------------- /Open with iTerm/build/Open with iTerm in Path Finder.app.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fallroot/applescript-applets/f4e2ecb9ee8488f8a2317d804268dc67a186379b/Open with iTerm/build/Open with iTerm in Path Finder.app.zip -------------------------------------------------------------------------------- /Open with iTerm/src/open-with-iterm-in-finder.scpt: -------------------------------------------------------------------------------- 1 | on getCurrentFolder() 2 | tell application "Finder" 3 | set selectionList to (selection as list) 4 | 5 | if length of selectionList is 1 then 6 | set firstItem to selectionList's first item 7 | 8 | (** 9 | * Selection's item is not accessible. 10 | * - When the Finder was just loaded. 11 | * - Selection is Network, Remote Disc and so on. 12 | **) 13 | try 14 | set itemKind to kind of firstItem 15 | on error 16 | return "" 17 | end try 18 | 19 | if itemKind is "Folder" or itemKind is "Application" or itemKind is "Volume" then 20 | set currentFolder to firstItem as string 21 | else 22 | set currentFolder to firstItem's container as alias 23 | end if 24 | else 25 | set currentTarget to target of front Finder window as string 26 | 27 | if currentTarget is "" then 28 | return "" 29 | else 30 | set currentFolder to currentTarget 31 | end if 32 | end if 33 | 34 | return quoted form of POSIX path of currentFolder 35 | end tell 36 | end getCurrentFolder 37 | 38 | on openWithiTerm(thePath) 39 | tell application "iTerm" 40 | activate 41 | 42 | tell current session of current terminal 43 | write text "cd" & space & thePath 44 | end tell 45 | end tell 46 | end openWithiTerm 47 | 48 | on run 49 | set currentFolder to getCurrentFolder() 50 | 51 | if currentFolder is "" then 52 | display alert "Select only one folder or file" 53 | return 54 | end if 55 | 56 | openWithiTerm(currentFolder) 57 | end run 58 | -------------------------------------------------------------------------------- /Open with iTerm/src/open-with-iterm-in-pathfinder.scpt: -------------------------------------------------------------------------------- 1 | on getCurrentFolder() 2 | tell application "Path Finder" 3 | set selectionList to selection as list 4 | set firstItem to selectionList's first item 5 | set currentTarget to first finder window's target 6 | 7 | if firstItem is not missing value and selectionList's length is 1 then 8 | if firstItem's class is fsFolder then 9 | set currentFolder to firstItem 10 | else 11 | set currentFolder to firstItem's container 12 | end if 13 | else 14 | if currentTarget is missing value then 15 | return "" 16 | else 17 | set currentFolder to currentTarget 18 | end if 19 | end if 20 | 21 | return quoted form of (POSIX path of currentFolder as string) 22 | end tell 23 | end getCurrentFolder 24 | 25 | on openWithiTerm(thePath) 26 | tell application "iTerm" 27 | activate 28 | 29 | tell current session of current terminal 30 | write text "cd" & space & thePath 31 | end tell 32 | end tell 33 | end openWithiTerm 34 | 35 | on run 36 | set currentFolder to getCurrentFolder() 37 | 38 | if currentFolder is "" then 39 | display alert "Select only one folder or file" 40 | return 41 | end if 42 | 43 | openWithiTerm(currentFolder) 44 | end run 45 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # AppleScript Applets 2 | 3 | Collection of AppleScript applets. 4 | 5 | - Applets that will run in the toolbar of Finder or Path Finder. 6 | 7 | ## Installation 8 | 9 | 1. Download any_app/build/any_app.zip file. 10 | 2. Unzip downloaded file. 11 | 3. Drag and drop the app into the Finder or Path Finder toolbar. 12 | 13 | ## Applet List 14 | 15 | - Open with iTerm 16 | - Open with Sublime Text 17 | - Open with Sublime Text 2 18 | --------------------------------------------------------------------------------