Re: ongoing Senior moments
Re: ongoing Senior moments
- Subject: Re: ongoing Senior moments
- From: Yvan KOENIG <email@hidden>
- Date: Mon, 01 Dec 2014 12:38:36 +0100
Le 30/11/2014 à 23:24, Shane Stanley < email@hidden> a écrit :
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.)
I'm puzzled.
Must I assume that the french system is more fair than the English one ?
The script :
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)
The events log :
tell application "System Events" get path of disk item "~/Pictures/APOD ƒ/" end tell tell application "Script Editor" choose file default location alias "SSD 500:Users:yvankoenig:Pictures:APOD ƒ:" end tell Résultat : alias "SSD 500:Users:yvankoenig:Pictures:APOD ƒ:eso1121b.jpg"
Yvan KOENIG (VALLAURIS, France) lundi 1 décembre 2014 12:38:31
|
_______________________________________________
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