How to paste the File Path into TextEdit or named Clipboard Via a macro in Osx High Sierra?

I have not found a way to even find the file path in High Sierra. In Mavericks it is simple.
Would have hoped to avoid any scripting or other complicated way.

My goal:
To select a file in Finder, then hit a Keyboard trigger + having the file path pasted into Textedit or into a named clipboard.

Sorry, but AFAIK the only way to get the TextEdit document path is via a short script.

Try this macro to get you started.
Click in TextEdit where you want the path to be inserted.

MACRO:   Paste Path of TextEdit Front Document [Example]

~~~ VER: 1.0    2019-03-24 ~~~

DOWNLOAD:

Paste Path of TextEdit Front Document [Example].kmmacros (2.2 KB)
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


image

1 Like

Thanks! So In order to do this I must be in the Finder, then select the file and then trigger the macro via a Keyboard trigger like Command Shift F?

This is what i wanted. Perhaps I should have been more specific. To select a file in Finder, then hit a Keyboard trigger + having the file path pasted into Textedit or into a named clipboard.

Hey Saimen,

Here you go:

Finder -- Selected File Paths to TextEdit v1.00.kmmacros (6.7 KB)

Keep in mind too that C will copy selected file paths in the Finder.

-Chris

2 Likes

OK, to start in the Finder, use this:

MACRO:   Copy Path of Finder Item [Example]


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/3/c/3c7634368509090a095b999429a5c5b310d2403a.kmmacros">Copy Path of Finder Item [Example].kmmacros</a> (2.1 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|458x606](upload://6NwFgrWnc8PnsQGqYokgQP2aEWA.png)
1 Like

A post was split to a new topic: How Do I Create a Hyperlink to a File in Evernote?

Chris, thank you :smiley: !

1 Like

Hey Saimen,

I'm guessing you're not getting the proper encoding for spaces and special characters for the file-URLs.

Try this script.

-Chris

------------------------------------------------------------
# Auth: Christopher Stone
# dCre: 2019/03/24 14:30
# dMod: 2019/03/24 15:20
# Appl: Finder, TextEdit
# Task: Append File-URLs of Selected Files in Finder into the Front TextEdit Document.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @Finder, @TextEdit, @Append, @File-URL, @URL, @Selected, @Files, @Finder, @TextEdit
------------------------------------------------------------

try
   
   tell application "Finder"
      set finderSelectionList to selection as alias list
      
      repeat with i in finderSelectionList
         set contents of i to URL of (contents of i)
      end repeat
      
   end tell
   
   set AppleScript's text item delimiters to linefeed
   
   set finderSelectionList to finderSelectionList as text
   
   tell application "TextEdit"
      activate
      if not (window 1 exists) then make new document
      tell front document
         make new paragraph at after last character with data (finderSelectionList & linefeed)
         set font of paragraphs to "Menlo"
         set size of paragraphs to 14
      end tell
   end tell
   
on error e number n
   set e to e & return & return & "Num: " & n
   if n ≠ -128 then
      try
         tell application (path to frontmost application as text) to set ddButton to button returned of ¬
            (display dialog e with title "ERROR!" buttons {"Copy Error Message", "Cancel", "OK"} ¬
               default button "OK" giving up after 30)
         if ddButton = "Copy Error Message" then set the clipboard to e
      end try
   end if
end try

------------------------------------------------------------
1 Like

Then this suggestion from Chris @ccstone is your best solution:

1 Like

Thanks, but I do not belive that is the problem:
I have a pdf file which opens fine in Evernote with this file-path:
file:///Applications/Utilities/System Information.app/Contents/Resources/ProductGuides/ENERGY STAR.pdf

And this path does not work ("Evernote does not have permissions"):

file:////Users/sm/OneDrive/Komme i gang med OneDrive.pdf

Maybe this is a typo, but it looks like to me that you have too many slashes in the last URL. Should be only 3:
file:///Users/sm/OneDrive/Komme i gang med OneDrive.pdf

If you are stilling permissions issues, then check the System Preferences to ensure Evernote has permission. If you're running Mojave there may be other SP permissions you need to set.

Also, check/compare the permissions in the Get Info of both folders.

1 Like

Yes! Thanks. You are right: There were 4 /, but even after removing one like this, still not allowed to open by Evernote.

I run High Sierra. How to "check the System Preferences to ensure Evernote has permissions?"