• 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: Folder test
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Folder test


  • Subject: Re: Folder test
  • From: SemiColon <email@hidden>
  • Date: Mon, 4 Dec 2000 19:25:50 -0800

At 3:30 PM -0800 12/4/00, Brad wrote:
>Hello again,
>
>I have a droplet that process a folder hierarchy.
>
>I want to test to make sure it was a folder and not
>something else that was dropped on it.
>
>I tried the following:
>
>*************
>
>if itemPassed is folder then
>"do stuff"
>else
>display dialog
>end if

Below are some speed results I obtained recently, after a similar thread. "Info for" has a lot of overhead as previously reported.

What I passed to the script was a "select all" of my system folder with a few of the folders toggled to display contents.

et is the time in ticks. Each construct ran twice.

c was a rough test that helped me check the scripts.

;

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

tell application "Finder" to set l to selection as alias list

set t1 to the ticks
set c to 0
repeat 10 times
repeat with f in l
if not folder of (info for f) then set c to (c + 1)
end repeat
end repeat
set t2 to the ticks
set et to t2 - t1
c
-- 2072 et
-- 1746 et
-- 90 c

set t1 to the ticks
set c to 0
repeat 10 times
repeat with f in l
if not (f as string)'s last item is ":" then set c to (c + 1)
end repeat
end repeat
set t2 to the ticks
set et to t2 - t1
c
-- 78 et
-- 79 et
-- 90 c

set t1 to the ticks
set c to 0
repeat 10 times
set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ":"}
repeat with f in l
if not (f as string)'s last text item is "" then set c to (c + 1)
end repeat
set AppleScript's text item delimiters to oldTID
end repeat
set t2 to the ticks
set et to t2 - t1
c
-- 77 et
-- 75 et
-- 90 c


References: 
 >Folder test (From: Brad <email@hidden>)

  • Prev by Date: Re: Process nested folders
  • Next by Date: Re: FindFile
  • Previous by thread: Re: Folder test
  • Next by thread: Re: Folder test
  • Index(es):
    • Date
    • Thread