Skip to content

Instantly share code, notes, and snippets.

@shauvik
Created June 12, 2014 18:06
Show Gist options
  • Save shauvik/f6b22731c9df74b092d3 to your computer and use it in GitHub Desktop.
Save shauvik/f6b22731c9df74b092d3 to your computer and use it in GitHub Desktop.
AppleScript to open current Finder directory in Atom editor
(*
* 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
@z00m1n
Copy link

z00m1n commented May 1, 2017

When I try running this, I get an error message

`OpenAtomHere:846:862: execution error: Atom Helper got an error: Application isn’t running. (-600)`

I tried the solutions I could find, but couldn't get this to work:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment