Created
June 12, 2014 18:06
-
-
Save shauvik/f6b22731c9df74b092d3 to your computer and use it in GitHub Desktop.
AppleScript to open current Finder directory in Atom editor
This file contains 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
(* | |
* Finder Open Atom Here - v1.0 - 6/12/2014 | |
* http://shauvik.com/ | |
* | |
* Copyright (c) 2014 Shauvik Roy Choudhary | |
* Dual licensed under the MIT and GPL licenses. | |
* Based on Open iTerm Here script by Ben Alman | |
*) | |
tell application "Finder" | |
set mySelected to get selection as list | |
if (count of mySelected) is not 0 then | |
set myItem to first item of mySelected | |
if class of myItem is alias file then | |
set myItem to original item of myItem | |
end if | |
if class of myItem is in {file, document file, internet location file} then | |
set myItem to container of myItem | |
end if | |
else if the (count of window) is not 0 then | |
set myItem to folder of the front window | |
else | |
set myItem to path to desktop folder | |
end if | |
my open_Atom(myItem) | |
end tell | |
on open_Atom(myItem) | |
set myPath to POSIX path of (myItem as string) | |
tell application "Atom" | |
open myPath | |
end tell | |
end open_Atom |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When I try running this, I get an error message
I tried the solutions I could find, but couldn't get this to work: