Re: Get UNIX path of selected file
Re: Get UNIX path of selected file
- Subject: Re: Get UNIX path of selected file
- From: Camilla <email@hidden>
- Date: Thu, 04 Apr 2002 01:24:26 +0100
This from Dave Balderstone - dated 4/4/02 12.31 am:
>
Is there an easy way to get the Unix path of a finder selection? I want to
>
pass it to the terminal.
Adapting my earlier script:
set theDesktop to path to desktop
tell application "Finder"
activate
try
set thePath to selection as alias
set theWindow to folder of Finder window 1 as alias
my savePath(thePath, theWindow, theDesktop)
on error
display dialog "More than one item is selected" buttons {"Sorry"}
default button 1 with icon caution
end try
end tell
on savePath(thePath, theWindow, theDesktop)
if thePath is not in {theWindow, theDesktop} then
set theFile to POSIX file (thePath as string)
tell application "Finder"
activate
set the clipboard to theFile as text
end tell
else
tell application "Finder" to display dialog "No file or folder is
selected" buttons {"Sorry"} default button 1 with icon caution
end if
end savePath
Should be even more straightforward if you're just saving the string into a
variable.
Camilla
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.