• 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 22:59:24 +0200


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


On Jun 29, 2015, at 15:20 , Yvan KOENIG <email@hidden> wrote:


Le 29/06/2015 à 20:24, Christopher Stone <email@hidden> a écrit :

On Jun 29, 2015, at 11:00, Deivy Petrescu <email@hidden> wrote:
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.
______________________________________________________________________

Hey Deivy,

Well, that depends on how you do it.  :)

-------

Because of this kind of mess I never use Posix Paths in the Finder.

There are occasions where I'll use Posix-Files if I've created them outside of the Finder, because those are actually of «class furl» — and the Finder likes them fine.

--
Best Regards,
Chris

Take care of the rule and you will not face problems.

I repeat : except for a short list of them, calling an OSAX function in a tell application is forbidden.
In your example, from my point of view, what is not normal is the fact that the second call fails.
What is not matching the rule is the fact that the first one works.

If you take care of the rule, the second case works :

tell application "Finder"

# Works
set PF1 to POSIX file "/Users/chris/Desktop/Finder.snapz.009.jpg"
exists PF1

set PF2 to "/Users/chris/Desktop/Finder.snapz.009.jpg"

# Works !

tell me to set PF2 to POSIX file PF2
exists PF2
end tell

Yvan KOENIG (VALLAURIS, France) lundi 29 juin 2015 21:19:40


Yvan, now I beg to disagree.
Chris example calls Posix file twice inside the Finder tell block.
In one case it works and in the other it doesn’t.

Quite surprising to me.

Checking further in the second case, the Finder does not convert the file to HFS file.
Actually it does not use the command at all.

Run this (change the file path…)
———

tell application "Finder"

set PF1 to POSIX file "/Users/deivy/Desktop/ScreenShot.png"
exists PF1

set PF2 to "/Users/deivy/Desktop/ScreenShot.png"
exists (POSIX file PF2)

end tell

log window:

tell application "Finder"
exists file "SSD_Seed:Users:deivy:Desktop:ScreenShot.png"
--> true
exists POSIX file "/Users/deivy/Desktop/ScreenShot.png"
--> false
end tell
Result:
false



Hello Deivy

It seems that you missed a sentence :

What is not matching the rule is the fact that the first one works.

My understanding is that in the 1st case, some tests which are made in the 2nd one aren't executed so the script doesn't see that what it is doing is "illegal".

Yvan KOENIG (VALLAURIS, France) lundi 29 juin 2015 22:58:51


 _______________________________________________
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: 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>)
 >Re: Finder "duplicate" requirements (From: Christopher Stone <email@hidden>)
 >Re: Finder "duplicate" requirements (From: Yvan KOENIG <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