• 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: Global Find and Replace
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global Find and Replace


  • Subject: Re: Global Find and Replace
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 26 Oct 2005 14:27:15 -0700

On Oct 26, 2005, at 2:16 PM, Dana Hill wrote:

On Oct 26, 2005, at 4.23 PM, Brett Brooks wrote:

I need to change two characters in over 500 folder/document names. Is there some sort of applescript that I can use to do this? Specifically, I need to remove the " mark from several folders/ document titles.

I am a COMPLETE newbie, so any help is appreciated.

You will probably get more/better responses from a few members of this list, but OS X includes a whole host of basic, yet often quite useful, AppleScripts in the following folder...


Users/[username]/Library/Scripts/

'Replace Text in Item Names.scpt' is probably just the script you're looking for. If you don't find it on your system, send me an e-mail off list, and I'll send you the file.

Actually, that one will be in /Library/Scripts/Finder Scripts. You can turn on Script Menu (see /Applications/AppleScript/AppleScript Utility) to give you a menu command to trigger it.


Alternatively, you could forget about AppleScript (for now) and go use Automator instead. AppleScript is great when you need highly custom behavior and complete control, but for common-ish tasks like this, Automator is a lot simpler. What you're describing is basically two actions in Automator: Get Selected Finder Items (or maybe Get Specified), followed by Rename Finder Items.

If you need to do the exact same replacement for months on end, you can save a complete workflow as a canned thing; press one button and it runs. However, you can also use it to add new commands to the Finder:

1. In the Finder, control-click on an item (any item, really) and pick Automator > Create Workflow.

2. Automator launches and makes a new document for you with a Get Specified Finder Items action. Remove that action. (Click the "x" in the action's "title bar".)

3. Add a Rename Finder Items action. When it asks you about adding a Copy action before it, select Don't Add. (This action can do a number of different things; if you have a usual one, like replacing text, pick it now.)

4. Turn down the Options triangle and check Show When Run.

5. Save -- you'll get a Save Plug-in As dialog; name it something like "Bulk Rename".

Congratulations, you now have a Bulk Rename command in the Finder! Select the items you want to munge, control-click, pick Automator > Bulk Rename, and you'll get a dialog asking you how you want to rename them. The same technique can be applied to much more complex workflows, of course.


--Chris Nebel AppleScript and Automator Engineering

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Global Find and Replace (From: Brett Brooks <email@hidden>)
 >Re: Global Find and Replace (From: Dana Hill <email@hidden>)

  • Prev by Date: Re: Global Find and Replace
  • Next by Date: Re: Producing Unicode-only characters
  • Previous by thread: Re: Global Find and Replace
  • Next by thread: day of era numbering
  • Index(es):
    • Date
    • Thread