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: Sat, 03 Jan 2015 09:47:32 -0500
> On Jan 2, 2015, at 14:30 , Alex Hall <email@hidden> wrote:
>
> Hi list,
> A friend asked me to hack together a script that will copy the names of all the files in the current folder *and* any subfolders. I'm still in the beginning stages, making sure I have the right terms and such. Here's my script so far:
>
> 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's items
> display dialog name of f & "< " & (size of f as text)
> repeat with p in properties of f
> display dialog p as text
> end repeat
> end repeat
> end tell
>
> The problem is that, once that first display dialog appears and I dismiss it, Finder pops up instead of the Script Editor, and no other display dialog runs. It's as though Finder is showing me that front window instead of executing the "repeat" statements, for some reason. The path and count the initial dialog shows are correct, so that's working. Why then is Finder appearing, and no dialogs displaying at all? Related: if something like this already exists, can someone let me know and save me the time? I don't mind doing it, but I'd rather not re-invent the wheel. Thanks!
>
> --
> Have a great day,
> Alex Hall
> email@hidden
Actually, there is a command to do exactly that.
It had been broken for a very long time, and everyone complained about that.
After it was fixed it has been rarely mentioned.
<script>
tell application "Finder"
set mainfldr to target of window 1
return entire contents of mainfldr as alias list
end tell
<script>
It is very fast too!
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