Re: Find All (Scriptable) Applications
Re: Find All (Scriptable) Applications
- Subject: Re: Find All (Scriptable) Applications
- From: Andy Wylie <email@hidden>
- Date: Thu, 05 Jul 2001 18:21:27 +1200
on 5/7/01 3:23 pm, Rob Jorgensen at email@hidden wrote:
>
On 7/4/01, Michelle Steiner commented:
>
>
> On 7/4/01 6:21 PM, Sun Real <email@hidden> wrote:
>
>
>
>> Don't know about quickly, but the Finder can directly get a list of
>
>> scriptable apps:
>
>>
>
>> tell application "Finder"
>
>> set myASAppList to (name of every application file) of entire contents
>
>> of startup disk whose (has scripting terminology) is true
>
>> end tell
>
>
>
> After 30 minutes, I interrupted the script.
>
>
I made two modifications to the the script (took the name out of
>
it/checked all partitions) and it ran in under 2 minutes (20 GB
>
drive/6 partitions). Obviously, among other factors, the number of
>
files on the drive(s) will greatly impact the amount of time it takes
>
to complete the script. I keep my drive relatively tidy, but I can
>
see where this would be a painfully long process on a drive/drives
>
with tens of thousands of files (which I suspect is not abnormal). It
>
also appears to hog RAM when run repeatedly. Bad Finder! :P
It fails with -1728 here, I did get it to work to some degree but it
reported too many open files and other errors.
I tried a few things and Akua and Tanaka's OSAX were easily the fastest...
----------------------
set app_list to MT List Files of (path to "root") of type {"APPL", "appe"}
with sub folders--Tanaka's
--set app_list to the entries in (path to "root") whose types are in
{"APPL", "appe"} to a depth of -1 with visibility--Akua
set asApps to {}
repeat with i in app_list
try
set x to MT Load Resource i type "aete"--Tanaka's
--set x to the resource of type "aete" in i--Akua
set AppleScript's text item delimiters to {":"}
set appName to text item -1 of (i as string)
set AppleScript's text item delimiters to ""
set end of asApps to {appName, i}
on error m number n
end try
end repeat
----------------------
"root" has 10646 files occupying 567 of 685MB
57 of 395 apps have an "aete" resource
Seconds x10 runs
MT List Files --69.84
MT Load Resource--147.68
-- 217.52
the entries in --84.06
the resource of type --114.01
-- 198.07
Adding filtering parameters to 'the entries in' showed no appreciable
difference but I've seen different parameters such as file name give quite
different results comparing these two. I'm surprised either of them are so
fast loading all those resources.
This was all run in Smile (don't blame me) and timed with it's neato chrono
_____________________________
Long live Motuyaki, Greg and Emmanuel!
__________________________________ Andy