• 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: Script that "Tells" Finder just Focuses on Finder instead of running
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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: Luther Fuller <email@hidden>
  • Date: Sun, 04 Jan 2015 12:55:26 -0600

On Jan 2, 2015, at 5:40 PM, Shane Stanley wrote:

Possibly not. The property you should probably use is class.

The Finder is notoriously slow, and I wouldn't use if for something like this unless you're only going to use it with small-ish folders. You mentioned shell alternatives, but they fall foul of package documents. Nevertheless, something like this should get you started:

There is a problem telling the difference between a document which is a package or bundled folder and a plain vanilla folder.

I was slow to remember this, but there is a way to do it.

This example script looks inside folders that it should not ...

property testFolder : alias "OS_X:Library:Frameworks"

on run
my getFolders(testFolder)
end run

on getFolders(folderAlias)
tell application "Finder"
set folderList to (folders of folderAlias) as alias list
repeat with aFolder in folderList
display dialog (name of aFolder) as text
my getFolders(aFolder)
end repeat
end tell
end getFolders

The test folder I have used in this example is full of folders with the extension 'framework'.
The script above will show the contents of these folders, however, but you don't want to see the contents of these folders.
The following script has a small modification which corrects this problem ...

property testFolder : alias "OS_X:Library:Frameworks"

on run
my getFolders(testFolder)
end run

on getFolders(folderAlias)
tell application "Finder"
set folderList to (folders of folderAlias) as alias list
repeat with aFolder in folderList
if (name extension of aFolder) = "" then
display dialog (name of aFolder) as text
my getFolders(aFolder)
end if
end repeat
end tell
end getFolders

If the test folder contains a folder named "untitled.folder" then the script WILL look inside because
'folder' is not a valid name extension. But 'framework' is a valid extension and the script will
NOT look inside these folders.
Package documents DO HAVE valid name extensions, so the script will not look into their contents.




 _______________________________________________
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

References: 
 >Script that "Tells" Finder just Focuses on Finder instead of running (From: Alex Hall <email@hidden>)

  • Prev by Date: Re: Script that "Tells" Finder just Focuses on Finder instead of running
  • Next by Date: Re: Script that "Tells" Finder just Focuses on Finder instead of running
  • Previous by thread: Re: Script that "Tells" Finder just Focuses on Finder instead of running
  • Next by thread: Re: Script that "Tells" Finder just Focuses on Finder instead of running
  • Index(es):
    • Date
    • Thread