• 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
Finder error problem?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finder error problem?


  • Subject: Finder error problem?
  • From: Jim Brandt <email@hidden>
  • Date: Mon, 6 Dec 2010 07:58:11 -0600

Does Finder have a problem correctly identifying the existence of filenames with leading zeros, or is this an AS problem?

Try this example:

Create a folder with a single file in it named "Picture 1" and leave the window open in Finder.

Then run this script:

set firstFiles to {"Pic 1", "Pic 01", "Pic 001", "Picture 1", "Picture 01", "Picture 001"}

tell application "Finder" to set source_folder to (folder of the front window) as text

repeat with i from 1 to count of firstFiles
set this_item to item i of firstFiles
set file_name to (source_folder & this_item) as text
tell application "Finder" to set found_first to exists file file_name
tell application "Finder" to display dialog file_name & tab & found_first
end repeat


On my machine (PowerMac G4 dual 450 running OSX 10.4.11) I get:

Pic 1 found_first = false <== correct
Pic 01 found_first = false <== correct
Pic 001 found_first = false <== correct
Picture 1 found_first = true <== correct
Picture 01 found_first = true <== incorrect
Picture 001 found_first = true <== incorrect

with only a single file in the folder.

Is there a better way to check for the existence of the exact file name without jumping through hoops?

BTW, this was part of a larger script that then failed to retrieve the file name for a nonexistant file that the script said existed.

TIA,

Jim
 _______________________________________________
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 error problem?
      • From: "Mark J. Reed" <email@hidden>
    • Re: Finder error problem?
      • From: Axel Luttgens <email@hidden>
  • Prev by Date: Re: Given a POSIX Path...
  • Next by Date: Sorting a list of aliases
  • Previous by thread: Re: Given a POSIX Path...
  • Next by thread: Re: Finder error problem?
  • Index(es):
    • Date
    • Thread