Text im Dateinamen ersetzen

A-Better-Finder-Renamer und andere Tools machen das u.a. auch. Diese Skript ist aber recht klein und tut als Droplet bzw. als Skript im Skript-Menü genau das, was man immer mal wieder kurz machen möchte.... einfach ein bischen Search&Replace in Dateinamen:

on open these_items
  tell application "Finder"
    display dialog "Replace:" default answer ""
    set searchstring to text returned of the result
    display dialog "with:" default answer ""
    set replacestring to text returned of the result
    repeat with this_item in these_items
      set itemname to name of this_item
      set AppleScript's text item delimiters to searchstring
      set the item_list to every text item of itemname
      set AppleScript's text item delimiters to replacestring
      set this_text to the item_list as string
      set AppleScript's text item delimiters to ""
      set name of this_item to this_text as text
    end repeat
    
  end tell
end open
on run
  
  tell application "Finder"
    set these_items to selection
    
    display dialog "Replace:" default answer ""
    set searchstring to text returned of the result
    display dialog "with:" default answer ""
    set replacestring to text returned of the result
    set these_items to selection
    
    repeat with this_item in these_items
      set itemname to name of this_item
      set AppleScript's text item delimiters to searchstring
      set the item_list to every text item of itemname
      set AppleScript's text item delimiters to replacestring
      set this_text to the item_list as string
      set AppleScript's text item delimiters to ""
      set name of this_item to this_text as text
    end repeat
    
  end tell
end run
									

This entry was posted in Finder and tagged , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

CAPTCHA:


3 + seven =

Subscribe without commenting

  • Seite übersetzen:


    Paypal for Pizza:




  • Kategorien


  • Letzte Kommentare

    • Niklas: Vielen Vielen Dank! So klappt es!
    • hubi: Servus Niklas, ich habe mir den Quellcode noch einmal angesehen und habe nun unter 10.7.3 einen Weg gefunden...
    • Niklas: Klingt super das Script. Leider bekomm ich immer folgende Fehlermeldung: error “„Mail“ hat einen Fehler...
    • Jürgen: Hallo Hubi, beim Abfragen von Kennworten gibt es noch eine böse Falle: Das Format, in dem security antwortet,...
    • hubi: Am einfachsten Du öffnest im AppleScript-Editor mal das Funktionsverzeichnis (unter Ablage) von iTunes. Ein...