• 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: Streamlining a script using the "Record" class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Streamlining a script using the "Record" class


  • Subject: Re: Streamlining a script using the "Record" class
  • From: "Marc K. Myers" <email@hidden>
  • Date: Sun, 25 Nov 2001 23:54:12 -0500
  • Organization: [very little]

> Date: Wed, 21 Nov 2001 12:36:11 -0600
> Subject: Streamlining a script using the "Record" class
> From: Eric Schult <email@hidden>
> To: <email@hidden>
>
> I'm trying to demonstrate to a PC-centric audience how Applescript can
> automate a task where Windows cannot. I've written an example script (below)
> that checks the file type of every file in a folder and appends an
> appropriate Windows suffix to the file name.
>
> I know I could do this simpler by keeping the file types and related
> suffixes in a record, but haven't worked much with the record class. I don't
> want to scare folks away from learning this if I can help it. Can anybody
> lend a hand with this or other simplification suggestions?
>
> Any help greatly appreciated.

I don't know how records could help you, but you could simplify your
script greatly by using a couple of lists. The first list would contain
file types. The second would contain the appropriate file suffixes.
Then, instead of repeating the same logic for each file type in a nested
"if" you would find the file type in list #1 and extract the suffix from
the corresponding position in list #2. Copy them into variables and use
those in a single occurrence of your file renaming logic.

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

[11/25/01 11:53:03 PM]


  • Follow-Ups:
    • Re: Streamlining a script using the "Record" class
      • From: Andy Wylie <email@hidden>
  • Prev by Date: AddressBook export
  • Next by Date: Re: Streamlining a script using the "Record" class
  • Previous by thread: Re: Streamlining a script using the "Record" class
  • Next by thread: Re: Streamlining a script using the "Record" class
  • Index(es):
    • Date
    • Thread