Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Applications > how do i easily copy the pathway to a file?

how do i easily copy the pathway to a file?
Thread Tools
Forum Regular
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jan 15, 2008, 01:09 PM
 
I used to have a script that allowed me to copy the entire path to an internal folder or file. For example instead of manually typing "Computer>System>Library>PreferencePanes>Print AndF ax.prefPane" to tell someone the path to something, I used to have a script that allowed me to click on PrintAndFax.prefPane and then hit the script and copy and paste the entire path to a textedit document. I thought it was called 'Get Path' but I can't locate it now. Anybody know what it's called and where it can be found.
Thanks,
Lou
     
Mac Elite
Join Date: Sep 2006
Status: Offline
Reply With Quote
Jan 15, 2008, 01:15 PM
 
Terminal will expose the path and give you something to copy and paste.
Drag the file into a Terminal window, done!
     
Posting Junkie
Join Date: Feb 2005
Location: 888500128
Status: Offline
Reply With Quote
Jan 15, 2008, 03:59 PM
 
dragging it into the text entry box down below here works, as well.
     
louh  (op)
Forum Regular
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jan 16, 2008, 06:02 PM
 
Originally Posted by Sherman Homan View Post
Terminal will expose the path and give you something to copy and paste.
Drag the file into a Terminal window, done!
Yes this works but it puts in extra characters. The script that I used just gave the pathway with backslashes between folders. I swear it was called Get Path but I couldn't find it with a Google search.
     
louh  (op)
Forum Regular
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jan 16, 2008, 06:07 PM
 
Originally Posted by analogika View Post
dragging it into the text entry box down below here works, as well.
This works perfectly it's easy to copy and paste and there are no extra characters as with Terminal. The problem however is that you need to log into this forum, or probably others, open a message; and then drag the file of interest into the text box. I only had to drag the file of interest on the script that resided in my dock with the script that I used to have.
     
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status: Offline
Reply With Quote
Jan 16, 2008, 08:00 PM
 
Open Automator and create the following workflow:



Then go to File->Save As Plug-In and save it as a plug-in for "Finder" with the name "Copy POSIX Path". From now on you can copy the path of any file from within the context menu in Finder (Other->Automator->Copy POSIX Path).
     
zro
Mac Elite
Join Date: Nov 2003
Location: The back of the room
Status: Offline
Reply With Quote
Jan 17, 2008, 12:42 AM
 
Mac style paths:
tell application "Finder" to set the clipboard to the selection

Unix style paths:
tell application "Finder" to set the clipboard to POSIX path of (the selection as alias)
(Last edited by zro; Jan 17, 2008 at 08:35 AM. (Reason:Made the Unix path a 1-liner))
     
louh  (op)
Forum Regular
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jan 19, 2008, 10:43 AM
 
I made the script saved it as a plug in for Finder and am able to go to a file and select Other->Automator->Copy Posix Path. I then tried to paste this into Texedit but the path would not paste. Am I doing something wrong. My automator workflow looks exactly like yours.
Thanks for the help. Once this works for me it will be perfect.
Thanks again.
Lou
     
Addicted to MacNN
Join Date: Aug 2004
Location: FFM
Status: Offline
Reply With Quote
Jan 21, 2008, 02:23 PM
 
Did you enter the script exactly as shown in the screenshot? The workflow worked for my when I created it.
     
Mac Elite
Join Date: Jan 2001
Status: Offline
Reply With Quote
Jan 24, 2008, 06:55 PM
 
No, no, no. You use this:

FilePathCM

Description from site:

FilePathCM is a contextual menu item for copying the:

POSIX path
HFS path
Full name
Display name
Extension
Windows style path
of a file or folder to the clipboard.

It can also be used for creating URLs from file paths, such as AFP type URLs. This is achieved using "prefixes" which are simply prepended to a URL encoded version of a POSIX path.
Or you could use this free one, which is not as good:

Hsoi's Shop: Software
     
zro
Mac Elite
Join Date: Nov 2003
Location: The back of the room
Status: Offline
Reply With Quote
Jan 25, 2008, 12:50 AM
 
Or you could do all that (and more) yourself using AppleScript and plug it into the Finder using Automator. For free.
     
Mac Elite
Join Date: Jan 2001
Status: Offline
Reply With Quote
Jan 25, 2008, 08:16 AM
 
Yeah, but Applescripts and AUtomator actions are slower.
     
louh  (op)
Forum Regular
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jan 25, 2008, 06:21 PM
 
Here is what I typed in Automater:
on run {input, parameters}
return POSIX path of input
end run
As you can see, I just copied the text and placed that in (not a picture like you did). But it looks identical to yours as far as I can tell. It still doesn't work though when I try and paste it into text edit after following your instructions: select Other->Automator->Copy Posix Path.
Am I not allowed to paste into text edit?
Sorry for the long delay in my response. It's been a hectic week.
Lou
     
Mac Elite
Join Date: Jun 2003
Location: Newport News, VA USA
Status: Offline
Reply With Quote
Jan 25, 2008, 07:31 PM
 
Did you add the "Copy to Clipboard" action?
     
zro
Mac Elite
Join Date: Nov 2003
Location: The back of the room
Status: Offline
Reply With Quote
Jan 26, 2008, 09:08 AM
 
Or just use this as the AppleScript...

tell application "Finder" to set the clipboard to POSIX path of (the selection as alias)
     
Addicted to MacNN
Join Date: Jun 1999
Location: Las Vegas, NV, USA
Status: Offline
Reply With Quote
Jan 26, 2008, 10:28 AM
 
Originally Posted by louh View Post
The script that I used just gave the pathway with backslashes between folders.
Those are slashes, NOT backslashes! Only Windows uses backslashes.
     
louh  (op)
Forum Regular
Join Date: Aug 2002
Status: Offline
Reply With Quote
Jan 31, 2008, 11:21 AM
 
Originally Posted by cybergoober View Post
Did you add the "Copy to Clipboard" action?
Thanks cybergoober for finding my mistake. It slipped my mind to include the "Copy to Clipboard". Also thank you TETENAL for writing out the script that best serves my needs. You had everything there I needed I just can't read sometimes - duh-!
Also thanks to everyone else for their suggestions. This forum is by far the best around.
Lou
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 03:53 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2