Skip to content

Commit

Permalink
Nicer handling of non-real locations (e.g. smart folder, search, netw…
Browse files Browse the repository at this point in the history
…ork, trash, etc)
  • Loading branch information
rkanter committed Jun 8, 2019
1 parent 3bf3656 commit a465f0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions applescripts/Terminal.applescript
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
tell application "Finder" to set thePath to target of front window as alias
set thePath to quoted form of POSIX path of thePath
tell application "Finder" to set thePath to target of front window
if not (exists thePath) then
tell application "Finder" to set theName to name of front window
display dialog "The location of the Finder window \"" & theName & "\" is not a real location (e.g. smart folder, search, network, trash, etc) and cannot opened in Terminal." with icon caution buttons {"OK"} default button "OK"
return
end if
set thePath to quoted form of POSIX path of (thePath as alias)

tell application "Terminal"
if it is running then
Expand Down
9 changes: 7 additions & 2 deletions applescripts/iTerm.applescript
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
tell application "Finder" to set thePath to target of front window as alias
set thePath to quoted form of POSIX path of thePath
tell application "Finder" to set thePath to target of front window
if not (exists thePath) then
tell application "Finder" to set theName to name of front window
display dialog "The location of the Finder window \"" & theName & "\" is not a real location (e.g. smart folder, search, network, trash, etc) and cannot opened in iTerm." with icon caution buttons {"OK"} default button "OK"
return
end if
set thePath to quoted form of POSIX path of (thePath as alias)

tell application "iTerm"
-- Handles the case where iTerm is running but has no windows
Expand Down

0 comments on commit a465f0d

Please sign in to comment.