Re: path of a Finder item
Re: path of a Finder item
- Subject: Re: path of a Finder item
- From: Jean-Christophe Helary <email@hidden>
- Date: Wed, 22 Mar 2017 21:09:17 +0900
On Mar 22, 2017, at 20:46, Shane Stanley < email@hidden> wrote:
On 22 Mar 2017, at 6:58 pm, Jean-Christophe Helary < email@hidden> wrote:
Is there a more straightforward way to get the posix path of a Finder item (something I'd need to send to the Terminal as an argument):
tell application "Finder" set projet_path to POSIX path of (selection as alias) end tell
I'm fine with this, since it works, but it seems a bit convoluted.
It's not really convoluted enough, unless you're happy to have an error when there's more than one item selected. If you want just the first item -- where first might admittedly be a moving target -- you would use something like:
I see. So basically I got the thing right from the start *except* for that right ? :-) I am *so* getting better at AS everyday...
The thing is just a way to call an app from the command line to act on a folder that I select manually (instead of copying the folder, turning to Terminal, typing the command, space, pasting the path, hitting return...) So I guess I would know if I selected more than one item, but thank you for the reminder that one always need to check for all the cases for error handling. tell application "Finder" set projet_path to POSIX path of item 1 of (selection as alias list) end tell
Jean-Christophe |
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden