Re: Process nested folders
Re: Process nested folders
- Subject: Re: Process nested folders
- From: "Marc K. Myers" <email@hidden>
- Date: Mon, 04 Dec 2000 18:17:10 -0500
- Organization: [very little]
Brad wrote:
>
Date: Mon, 04 Dec 2000 10:59:07 -0800
>
Subject: Process nested folders
>
From: Brad <email@hidden>
>
To: AppleScript list <email@hidden>
>
>
Hello,
>
>
I have a folder hierarchy for which I want to set window properties.
>
Below is a script that works if I drag group of folders onto it.
>
What I am looking for is to be able to drag the parent folder
>
to the droplet and process all nested folders.
>
>
I have adapted this script from AppleScript help modules.
>
>
**************
>
>
-- This droplet processes folders dropped onto the applet
>
on open these_items
>
repeat with i from 1 to the count of these_items
>
set this_item to item i of these_items
>
set the item_info to info for this_item
>
if (alias of the item_info is false) and ,
>
(folder of the item_info is true) then
>
process_item(this_item)
>
end if
>
end repeat
>
end open
>
>
-- this sub-routine processes folders
>
on process_item(this_item)
>
-- NOTE that the variable this_item is a folder reference in alias
>
format
>
-- FOLDER PROCESSING STATEMENTS GOES HERE
>
tell application "Finder"
>
activate
>
open this_item
>
set position of container window of this_item to {100, 100}
>
set size of container window of this_item to {400, 400}
>
set view of container window of this_item to name
>
close this_item
>
end tell
>
end process_item
This is the approach I would use:
on run
open ({choose folder})
end run
on open (itemList)
repeat with anItem in itemList
set theItem to the (contents of anItem) as text
if character -1 of theItem is ":" then
tell application "Finder"
set newList to items of alias theItem
end tell
open (newList)
procFldr(theItem)
end if
end repeat
end open
on procFldr(theFldr)
-- do something with the folder
end procFldr
Marc [12/4/00 6:16:47 PM]