• 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: Replace characters in filename
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Replace characters in filename


  • Subject: Re: Replace characters in filename
  • From: Rick Davis <email@hidden>
  • Date: Sat, 12 Jun 2004 19:39:49 -0400

On Jun 12, 2004, at 5:54 PM, Ken wrote:

Message: 17
Date: Sat, 12 Jun 2004 16:51:30 -0400
From: Graff <email@hidden>
Subject: Re: Replace characters in filename
To: 'email@hidden', users
<email@hidden>

On Jun 12, 2004, at 3:49 PM, Rick Davis wrote:

How would I find certain characters (any of a list of 13) in a
filename and replace them with one common character?

Heh, I just posted this yesterday. It's the same solution for cleaning
up files so they don't have any non-Windows characters, I just flipped
the logic in the CleanNames handler. Just change the
disallowedCharacters property to contain the characters you want to
strip and the replacementCharacter property to the character you want
to replace them with. If you set the replacementCharacter property to
"" then the script will just strip out the disallowed characters.


You are applesolutely right. I wrote a script a couple of weeks ago to help teachers transfer their documents from the Mac network to their district windoze network. It converts their Appleworks documents to either Word or Excel depending upon the file type. It also truncates the name to 27 characters and adds the dot plus the appropriate extension. I was just made aware of the "disallowed characters" on the darkside. I just ran your script and it worked great. Now I hope I can figure out how to incorporate it into my script to make it a one step operation for the already over-worked teachers. Someone suggested I also strip or replace common windoze expressions like "com1 thru com9, lpt1 thru lpt9, con, nul, and prn". Any thoughts on that suggestion? I think I am going to assume that no user has a file saved with any of those expressions and just let them know to manually change any that may.

Thanks for getting me over what was starting to look like a mountain instead of a mole hill.

Rick Davis
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: Replace characters in filename
      • From: Graff <email@hidden>
  • Prev by Date: Re: Replace characters in filename
  • Next by Date: Re: Hardware Mac Address
  • Previous by thread: Re: Replace characters in filename
  • Next by thread: Re: Replace characters in filename
  • Index(es):
    • Date
    • Thread