Re: Script that "Tells" Finder just Focuses on Finder instead of running
Re: Script that "Tells" Finder just Focuses on Finder instead of running
- Subject: Re: Script that "Tells" Finder just Focuses on Finder instead of running
- From: Deivy Petrescu <email@hidden>
- Date: Sun, 04 Jan 2015 09:32:33 -0500
> On Jan 3, 2015, at 20:28 , Shane Stanley <email@hidden> wrote:
>
> On 4 Jan 2015, at 3:52 am, Deivy Petrescu <email@hidden> wrote:
>>
>> Phil’s solution is by far the fastest and possibly the best solution.
>
> I disagree. Yes, it's the fastest -- but as Yvan alluded to, it ignores packages. Run it on a folder containing some rtfd files, or some apps, or any other package files, and it will treat them as folders and list their contents. IMO that rules it out as the best solution.
And I disagree with your disagreement.
First, I said possibly because I don’t know the extend of the “search”.
However, I can tell you that Phil’s solution provided me with a breakdown of my home folder faster than entire contents was able to cross one particular (“large”) folder.
>
> Recursively looping through with the Finder or System Events is slow, but at least they know what's a folder and what's a package. Alex didn't make clear what he was after exactly -- his sample output suggested he only wanted one level of subfolders deep. If that's the case, it shouldn't be too bad -- and there would be no point in using entire contents (and the shell offering would need to be rewritten to deal with that, too).
Exactly. Recursion is going to be to slow, Phil’s method will give me a text file from which I can easily eliminate all packages. It is much faster to deal with a text file that “walk” folders recursively.
>
> If you want both fast and accurate, your best bet IMO is ASObjC. But you knew I was going to say that. It would probably be a tad slower than the shell command, but not noticeably, and would be considerably faster than the Finder. I'd post some code, but there's not much point until Alex clarifies whether he wants full recursion or not (and if so, how to format it so the hierarchical content makes sense).
I disagree here too! The way to do this fast and accurately is by either using the shell or python, for instance, not AS.
Now, if you say that using AS ASObjC is a fast and accurate way to obtain this list, I agree, however, I still feel that "entire contents” is also a fast and accurate way of obtaining it.
Now, as you mentioned if one of the solutions takes 1 nano second, a second takes 1 micro second and yet another takes 1 mili second, it really makes no difference even if one is doing this 1000 times.
The perceived difference is zilch.
The whole thing depends very much on how big and deep those folders are
And, to the original post, I did not get the problem that was mentioned, I made (minor) some changes in the script and everything worked fine.
“display dialog” is not a finder command and one may, but do not need to, use "tell current application to display dialog”
Here is the script:
<script>
tell application "Finder"
set currentDir to (target of front window)
display dialog (currentDir as text) & " has " & ((currentDir's items) count) & " items."
repeat with f in currentDir
display dialog name of f & " < " & ((round (size of f) / 1000 rounding up) as text) & " KB"
repeat with p in properties of f
display dialog p as text
end repeat
end repeat
end tell
<script>
>
> --
> Shane Stanley <email@hidden>
> <www.macosxautomation.com/applescript/apps/>
Deivy Petrescu
email@hidden
_______________________________________________
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