Re: ongoing Senior moments
Re: ongoing Senior moments
- Subject: Re: ongoing Senior moments
- From: Shane Stanley <email@hidden>
- Date: Mon, 01 Dec 2014 09:24:26 +1100
On 1 Dec 2014, at 7:51 am, Yvan KOENIG <email@hidden> wrote:I just discovered that, under Yosemite (10.10.1),
set theFolder to "~/Pictures/APOD ƒ/"
tell application "System Events" set theFolder to path of disk item theFolder end tell
set theFolder to (choose file default location alias theFolder)
behaves flawlessly.
It doesn't here: System Events got an error: Can’t get disk item "~/Pictures/APOD ƒ/".
It seems that now there is no need to use old trickery to expand tilde prefixed paths.
But even if it does work, unless it's documented to do so, you're just risking having to fix scripts at some time in the future when it no longer works. Because there's no reason it should work in other than the shell.
And as you're talking Yosemite, the new "trickery" is one line:
set thePath to (current application's NSString's stringWithString:thePath)'s stringByExpandingTildeInPath() as text
(Not counting the 'use framework "Foundation"' you'll need somewhere.) |
_______________________________________________
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