• 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: 2nd try: Choose folder dialog and then process contents?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 2nd try: Choose folder dialog and then process contents?


  • Subject: Re: 2nd try: Choose folder dialog and then process contents?
  • From: Michelle Steiner <email@hidden>
  • Date: Wed, 6 Oct 2004 15:39:44 -0700


On Oct 6, 2004, at 2:23 PM, Mr Tea wrote:

Also, if you want the script to be recursive, specify 'every item' rather
than 'every file' to catch folders too.

I use "every file" for the files and "every folder" for the folders; that way, I can process the files in the folder and then use the list of folders for recursion, without having to test each item one-by-one.


Here is an example that changes the label of files to one color and of folders to another color:

set the topLevelFolder to (choose folder)

tell application "Finder"
	set foo to files of the topLevelFolder
	set bar to folders of the topLevelFolder
end tell
ProcessFiles(foo)
processFolders(bar)

to ProcessFiles(filesToBeProcessed)
	repeat with thisFile in filesToBeProcessed
		tell application "Finder"
			set the label index of thisFile to 4
		end tell
	end repeat
end ProcessFiles

to processFolders(foldersToBeProcessed)
	repeat with thisFolder in foldersToBeProcessed
		tell application "Finder"
			set the label index of thisFolder to 5
			set foo to files of thisFolder
			set bar to folders of thisFolder
		end tell
		ProcessFiles(foo)
		processFolders(bar)
	end repeat
end processFolders

--
I can't be in my second childhood;
I haven't finished the first one yet.

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: 2nd try: Choose folder dialog and then process contents?
      • From: Mr Tea <email@hidden>
References: 
 >Re: 2nd try: Choose folder dialog and then process contents? (From: Mr Tea <email@hidden>)

  • Prev by Date: Re: 2nd try: Choose folder dialog and then process contents?
  • Next by Date: Re: 2nd try: Choose folder dialog and then process contents?
  • Previous by thread: Re: 2nd try: Choose folder dialog and then process contents?
  • Next by thread: Re: 2nd try: Choose folder dialog and then process contents?
  • Index(es):
    • Date
    • Thread