• 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: Finding and replacing multiple characters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Finding and replacing multiple characters


  • Subject: Re: Finding and replacing multiple characters
  • From: Michelle Steiner <email@hidden>
  • Date: Tue, 8 Jul 2003 16:40:48 -0700

On Tuesday, July 8, 2003, at 04:04 PM, Yannick Brodeur wrote:

I need a script that would edit the names of files and folders in a
chosen directory. The following characters / \ : * ? " < > needs to be
replaced by an underscore.

I found this script, wich works great but only allows to change a
single character into an underscore.

set replace_chars to {"/", "\\", ":", "*", "?", "\"", "<", ">"}

set search_string to "How now / brown : cow * where < are > you > going?"

repeat with find_char in replace_chars
set text item delimiters to find_char
set search_string to (text items of search_string)
set text item delimiters to "_"
set search_string to search_string as text
end repeat
search_string

--> "How now _ brown _ cow _ where _ are _ you _ going_"

--
Impeach The Son Of A Bush!
_______________________________________________
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: Finding and replacing multiple characters
      • From: Robert Poland <email@hidden>
References: 
 >Finding and replacing multiple characters (From: Yannick Brodeur <email@hidden>)

  • Prev by Date: Finding and replacing multiple characters
  • Next by Date: Re: Finding and replacing multiple characters
  • Previous by thread: Finding and replacing multiple characters
  • Next by thread: Re: Finding and replacing multiple characters
  • Index(es):
    • Date
    • Thread