• 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: Finder "duplicate" requirements
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder "duplicate" requirements


  • Subject: Re: Finder "duplicate" requirements
  • From: Yvan KOENIG <email@hidden>
  • Date: Mon, 29 Jun 2015 18:21:16 +0200


Le 29/06/2015 à 18:00, Deivy Petrescu <email@hidden> a écrit :


On Jun 28, 2015, at 04:27 , Christopher Stone <email@hidden> wrote:

On Jun 28, 2015, at 02:14, Shane Stanley <email@hidden> wrote:
It's a common problem in Xcode-based apps, but I haven't noticed it in standard AppleScript before.
______________________________________________________________________

Hey Shane,

You mean in the Finder?

<snip>

 exists (get POSIX file posixPath)
 --> Finder got an error: Can’t get POSIX file "/Users/chris/test_directory/test".

end tell


I’ve noticed similar behavior with other apps.
If you pass the “command” as in :
exists (POSIX file posixPath)

The command will fail, meaning it will not return what you expect.
However, declaring a variable before as in

set pp to  POSIX file posixPath
exists pp

will always work.
The “get” inside the first command will always error.





Deivy Petrescu

What you get is perfectly normal and logical.

POSIX file belongs to the Osax Standard Additions so it's not supposed to be called in a tell application block.


set posixPath to "what you want"
tell application "Finder"
exists (POSIX file posixPath)
end tell

violate the rule and so it fails.

set posixPath to "what you want"
tell application "Finder"
exists (get POSIX file posixPath)
end tell

violate the rule too and so it fails.

set posixPath to "what you want"
tell application "Finder"
tell me to (POSIX file posixPath)
exists result
end tell

apply the official workaround and so it works.

set posixPath to "what you want"
(POSIX file posixPath)
tell application "Finder"
exists result
end tell

apply a logical syntax and so it works.


Now, when we have a POSIX path, as System Events is aware of posix paths, isn't it more logical to use :

tell application "System Events"
exists disk item posixPath
end tell


Yvan KOENIG (VALLAURIS, France) lundi 29 juin 2015 18:21:10







 _______________________________________________
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: Finder "duplicate" requirements
      • From: Shane Stanley <email@hidden>
    • Re: Finder "duplicate" requirements
      • From: Shane Stanley <email@hidden>
    • Re: Finder "duplicate" requirements
      • From: Deivy Petrescu <email@hidden>
References: 
 >Finder "duplicate" requirements (From: Jean-Christophe Helary <email@hidden>)
 >Re: Finder "duplicate" requirements (From: Shane Stanley <email@hidden>)
 >Re: Finder "duplicate" requirements (From: Christopher Stone <email@hidden>)
 >Re: Finder "duplicate" requirements (From: Deivy Petrescu <email@hidden>)

  • Prev by Date: Re: Finder "duplicate" requirements
  • Next by Date: Re: Finder "duplicate" requirements
  • Previous by thread: Re: Finder "duplicate" requirements
  • Next by thread: Re: Finder "duplicate" requirements
  • Index(es):
    • Date
    • Thread