• 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: Process all files in a folder?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Process all files in a folder?


  • Subject: Re: Process all files in a folder?
  • From: "Marc K. Myers" <email@hidden>
  • Date: Fri, 07 Sep 2001 11:34:03 -0400
  • Organization: [very little]

> Date: Fri, 07 Sep 2001 08:11:11 -0600
> Subject: Process all files in a folder?
> From: Rachel <email@hidden>
> To: AppleScript List <email@hidden>
>
> 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

You're setting doFile to the NAME of the file, not to the file itself.
To locate a file the Finder needs its complete path (or an alias). Try:

set doFile to (file bar of foo) as alias

Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074

[9/7/01 11:32:48 AM]


  • Prev by Date: Re: Final Reality Check (Was... I lost count)
  • Next by Date: Re: Reality Check (Was... I lost count)
  • Previous by thread: Re: Process all files in a folder?
  • Next by thread: Re: Process all files in a folder?
  • Index(es):
    • Date
    • Thread