RE: Alias List or Repeat in 8.1
RE: Alias List or Repeat in 8.1
- Subject: RE: Alias List or Repeat in 8.1
- From: Joe Kelly <email@hidden>
- Date: Wed, 19 Dec 2001 20:58:14 -0800
Bryan wrote:
>
-- sets path to a folder on the desktop
>
set DeskPath to the path to desktop as string
>
set SourceFolder to (DeskPath & "test:") as string
>
This sets SourceFolder to a string whose contents are "HD:Desktop
Folder:test:". You probably meant to do this instead:
set SourceFolder to ((path to desktop as string) & "test:") as alias
Now SourceFolder is an alias to your folder.
>
-- counts the folders in SourceFolder, it runs the script for each
>
folder inside SourceFolder
>
>
repeat with m from 1 to length of SourceFolder
>
set SubFolder to (SourceFolder & item m of SourceFolder) as text
I don't know if AppleScript by itself can count items in folders, so you
should wrap your repeat loop in a tell app finder block:
tell application "Finder"
repeat with SubFolder in SourceFolder
UploadSubFolderContents(SubFolder) of me -- Fetch code goes
in this handler.
end repeat
end tell
I think the "repeat with variable in container" works with 8.1, but if it
doesn't do this:
repeat with SubFolder from 1 to count of SourceFolder
have fun
joe