Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions Create New File/getFinder.applescript
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
tell application "Finder"
try
set pathList to POSIX path of (folder of the front window as alias)
on error
set pathList to POSIX path of (path to desktop folder as alias)
end try

return pathList
tell application "System Events"
set activeAppName to name of first application process whose frontmost is true
end tell

try
if activeAppName is equal to "Path Finder" then
tell application "Path Finder"
set pathList to the POSIX path of the target of the front finder window
end tell
else if activeAppName is equal to "Finder" then
tell application "Finder"
set pathList to POSIX path of (folder of the front window as alias)
end tell
else
set pathList to POSIX path of (path to desktop folder as alias)
end if
on error
set pathList to POSIX path of (path to desktop folder as alias)
end try

return pathList