• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: ongoing Senior moments
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.)

-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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

References: 
 >ongoing Senior moments (From: Robert Poland <email@hidden>)
 >Re: ongoing Senior moments (From: Deivy Petrescu <email@hidden>)
 >Re: ongoing Senior moments (From: Robert Poland <email@hidden>)
 >Re: ongoing Senior moments (From: Yvan KOENIG <email@hidden>)
 >Re: ongoing Senior moments (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: [rant] "Never mind the quality, feel the width!"
  • Next by Date: Re: [rant] "Never mind the quality, feel the width!"
  • Previous by thread: Re: ongoing Senior moments
  • Next by thread: No more "delay" in AS-Yosemite?
  • Index(es):
    • Date
    • Thread