• 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. Differentiating between "A1", "A12", "A13"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re. Differentiating between "A1", "A12", "A13"


  • Subject: Re. Differentiating between "A1", "A12", "A13"
  • From: has <email@hidden>
  • Date: Fri, 11 Jan 2002 12:03:35 +0000

Some genius belatedly realised:

<cough> Oh yeah. I overlooked one minor detail before: my routine wouldn't
catch problems if a user had given two files the same numerical code, e.g.
"A14 blah", "A14 doh". The necessary fix is shown below. HTH.

has

---------------------------------------------------

>on listFiles()
> copy emptyList to finishedList
> tell application "Finder"
> tell its folder theFolder
> set theList to every file whose name begins with "A"
> try
> repeat with x from 1 to count theList
> set fileName to theList's item x's name
> if fileName's character 3 is in "0123456789" then
> set offsetPos to fileName's text 2 thru 3
> else
> set offsetPos to fileName's character 2
> end if

--ADD EXTRA LINE HERE
if finishedList's item (offsetPos + 1) is not missing value then error
"Duplicate filename numbers: " & offsetPos


> set finishedList's item (offsetPos + 1) to theList's
>[NO-BREAK]item x as alias
> end repeat
> on error number -1700
> error "Bad filename: " & fileName & " (should have a
>[NO-BREAK]number after A)."
> end try
> end tell
> end tell
> finishedList's aliases
>end listFiles


  • Prev by Date: Re: Regular Expressions and Smile
  • Next by Date: Scriptable Search-and-Replace Utilities
  • Previous by thread: Re. Differentiating between "A1", "A12", "A13"
  • Next by thread: Mounting iDisk
  • Index(es):
    • Date
    • Thread