• 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
Replacing characters in filenames
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Replacing characters in filenames


  • Subject: Replacing characters in filenames
  • From: Peter Huxmann <email@hidden>
  • Date: Tue, 16 Jan 2001 14:11:10 -0600

Okay, so I'm kinda new to this whole Applescript thing, too, but I've tried
everything I can think of & can't seem to figure this one out:

Is there an easy way to change characters in file names? Specifically, I'm
trying to write a droplet that will replace spaces in file names with
underscores. (Goddamn internet!)

I've looked through everything I can find, (& tried many different things)
but no luck for me.
" " is ASCII character 32
"_" is ASCII character 95

Here's what I've got:

on open (TestFile)
set fileName to every character of (name of (info for alias (TestFile as
string)))
if fileName contains " " then
beep
display dialog "Yup, it's got a space, now what?" giving up after 3
end if
end open


Any suggestions?

(I know this one is easy...)

-p

----
Peter Huxmann
Carmichael Lynch Advertising
email@hidden


  • Follow-Ups:
    • Re: Replacing characters in filenames
      • From: "Christopher C. Stone" <email@hidden>
    • Re: Replacing characters in filenames
      • From: Yosemite <email@hidden>
  • Prev by Date: Re: Scripting PhotoShop.. and IPTC text (file info in JPG pictures)
  • Next by Date: exporting calendar from palm desktop 2.6?
  • Previous by thread: Re: Scripting PhotoShop.. and IPTC text (file info in JPG pictures)
  • Next by thread: Re: Replacing characters in filenames
  • Index(es):
    • Date
    • Thread