• 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, 10 Nov 2014 16:53:40 +0100


Le 10/11/2014 à 15:41, Robert Poland <email@hidden> a écrit :
…

As above -

tell application "Finder"
set theFolder to "" & "~/Pictures/APOD ƒ/"
set theFolder to  (choose file default location alias the folder
end tell
…

Robert Poland
Fort Collins CO


Hello Robert.
It seems that you decided to live dangerously.
Two typos in four instructions when two of them are useless.

Here is the code after autumn cleaning

-- tell application "Finder"
set theFolder to "" & "~/Pictures/APOD ƒ/"
--set theFolder to  (choose file default location alias the folder
set theFolder to (choose file default location alias theFolder)
-- end tell
I don't understand why you wrote

set theFolder to "" & "~/Pictures/APOD ƒ/"
when 
set theFolder to "~/Pictures/APOD ƒ/"
does exactly the same thing but I didn't edit the instruction.

As it was said many times, neither the Finder nor Applescript are able to work with unix paths starting with a tilde.
This code which use a handler to convert your unusable path into an usable one behaves flawlessly.

set theFolder to "" & "~/Pictures/APOD ƒ/"
set theFolder to my convertTildePathToHfs(theFolder)
set theFolder to (choose file default location alias theFolder)


on convertTildePathToHfs(aPath)
set pp to POSIX file (do shell script "echo " & quoted form of aPath)
log pp
tell application "System Events"
path of disk item (pp as text)
end tell
return result
end convertTildePathToHfs

I wish to add that it's a bit puzzling to see in the same message an instruction saying that the Pictures folder is at the root of the startup disk :

tell application "Finder" to set startLoc to (folder "APOD ƒ" of folder "Pictures" of startup disk) as alias 

and an other one saying that it is in your home folder.

set theFolder to "" & "~/Pictures/APOD ƒ/"

Yes, "~/" is in Unix format, the short version, unusable by the Finder or by AppleScript, of the path to your account, the one returned by
path to home folder


With such a mess, it's logical that at least one of the two pieces of code fail.
I guess that the folder Pictures:APOD ƒ is at the root of the startup volume or in your own user account but not in both.

Yvan KOENIG (VALLAURIS, France) lundi 10 novembre 2014 16:53:18


 _______________________________________________
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: Yvan KOENIG <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>)

  • Prev by Date: Re: ongoing Senior moments
  • Next by Date: No more "delay" in AS-Yosemite?
  • Previous by thread: Re: ongoing Senior moments
  • Next by thread: Re: ongoing Senior moments
  • Index(es):
    • Date
    • Thread