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

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


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

  • Follow-Ups:
    • Re: ongoing Senior moments
      • From: Shane Stanley <email@hidden>
  • Prev by Date: Re: How do I set folder action in Yosemite, please?
  • Next by Date: Re: ongoing Senior moments
  • Previous by thread: Re: How do I set folder action in Yosemite, please?
  • Next by thread: Re: ongoing Senior moments
  • Index(es):
    • Date
    • Thread