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 > Developer Center > Applescript - get current directory path

Applescript - get current directory path
Thread Tools
Addicted to MacNN
Join Date: Oct 2002
Location: England | San Francisco
Status: Offline
Reply With Quote
Jun 5, 2007, 03:04 PM
 
How hard would it be to create an applescript application that figures out what the current path is of the foremost window (i'd run this from the Finder toolbar buttons) and outputs it to the clipboard/dialog window?
we don't have time to stop for gas
     
zro
Mac Elite
Join Date: Nov 2003
Location: The back of the room
Status: Offline
Reply With Quote
Jun 5, 2007, 10:32 PM
 
tell application "Finder"
set the_folder to (folder of the front window) as text
set the clipboard to the_folder
display dialog the_folder
end tell


Doesn't work if the directory of the front window is higher than a drive however. "My computer" for example. If you want shell style paths, insert this line after the first line in the tell block...

set the_folder to POSIX path of the_folder
(Last edited by zro; Jun 6, 2007 at 12:06 AM. (Reason:Finish it off))
     
   
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 09:29 AM.
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