• 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's "exists" command ignores leading zero's in filename
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finder's "exists" command ignores leading zero's in filename


  • Subject: Re: Finder's "exists" command ignores leading zero's in filename
  • From: Shane Stanley <email@hidden>
  • Date: Fri, 23 May 2014 09:53:22 +1000

On 23 May 2014, at 4:13 am, Luther Fuller <email@hidden> wrote:

I modified the original script. Here's my script ...

-- the file "x000y.png" exists on the desktop
set deskPath to (path to desktop folder) as text
set filePath to (deskPath & "x0000y.png") as text -- this file does NOT exist
tell application "Finder"
set fileExists to (exists filePath) as text
end tell
display dialog fileExists & return & filePath

try
filePath as alias
on error errText number errNr
"Error = " & errNr & return & errText
display dialog the result
end try


It is clear from the behavior of this script that the Finder has a serious bug.

No, it's clear that the script has a serious bug. It's passing the exists command a string instead of a reference.

Experiment with line 2 by increasing the number of zeros in the file name.

Strings behave this way:
"0" ≠ "00" ≠ "000" ≠ "0000" ≠ "00000"

Integers behave this way:
0 = 00 = 000 = 0000 = 00000

The Finder is behaving as if a sub-string of zeros is equivalent to zero,
which is erroneous integer behavior, not correct string behavior.

In my script, above, the Finder incorrectly thinks that:
"x0y" = "x00y" = "x000y" = "x0000y" = "x00000y"

Perhaps I should post this message as a bug report,

The Finder's exists command takes a reference to an object, not a string. You're passing a string, so whatever you get is irrelevant.

-- 
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: 
 >Finder's "exists" command ignores leading zero's in filename (From: Bert Groeneveld <email@hidden>)
 >Re: Finder's "exists" command ignores leading zero's in filename (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Finder's "exists" command ignores leading zero's in filename
  • Next by Date: Re: Finder's "exists" command ignores leading zero's in filename
  • Previous by thread: Re: Finder's "exists" command ignores leading zero's in filename
  • Next by thread: Re: Finder's "exists" command ignores leading zero's in filename
  • Index(es):
    • Date
    • Thread