Process all files in a folder?
Process all files in a folder?
- Subject: Process all files in a folder?
- From: Rachel <email@hidden>
- Date: Fri, 07 Sep 2001 08:11:11 -0600
Scripters:
Thanks to Marc and Michelle for the components here.
This runs:
--Process all filenames in selected folder.
tell application "Finder"
set foo to (item 1 of the selection) as alias
repeat with bar from 1 to (count of files in foo)
set the filename to the name of file bar of foo
set part1 to text 1 thru 2 of filename
set part2 to text 4 thru -1 of filename
set filename to part1 & "_" & part2
set name of file bar of foo to filename
end repeat
end tell
But now I want to open Tex-Edit Plus and process every HTML file in the
folder:
tell application "Finder"
set doFile to ""
set foo to (item 1 of the selection) as alias
repeat with bar from 1 to (count of files in foo)
set doFile to the name of file bar of foo
tell application "Tex-Edit Plus"
activate
open doFile as alias
-- Process file with script(s)
close window 1 saving yes
end tell
end repeat
end tell
But this does not run.
The variable "doFile" seems to be known to TexEdit but I get the message
"can't find file filename" even when it knows the filename!
What am I doing wrong?
Rachel