• 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
Rip Van Applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Rip Van Applescript


  • Subject: Rip Van Applescript
  • From: Rich Reardon <email@hidden>
  • Date: Wed, 30 Jul 2008 15:58:17 -0500
  • Organization: Digital Media Center, University of Minnesota

So...
...after a 10 year hiatus on the Redmond dark side, I return to routinized Mac use and resurrect a previously working Applescript (below) to accommodate a workflow requiring me to find a pattern in filenames and replace it.


The damn thing doesn't even compile past the first line.

After you recover from paroxysms of laughter at the presumption of my code, perhaps you can point me in the direction of a Regular expression OSAX that's current (or perhaps Applescript is wired to deliver it now?). Thanks.

------------------------------------------
uses Scriptable Finder; uses Tanaka's OSAX
set user_input to display dialog "Enter part/whole name of filename to be changed" default answer "filename"
if button returned of user_input is "ok" then
set file_seg to text returned of user_input
end if
set user_input to display dialog "Enter file name replacement string" default answer "replace string"
if button returned of user_input is "ok" then
set rfstring to text returned of user_input
end if
set target_folder to choose folder with prompt "Select folder whose filenames you wish to change"
set file_list to list folder target_folder
repeat with an_item in file_list
set old_name to (an_item as string)
if old_name contains file_seg then
set new_name to xReplace old_name search file_seg replace rfstring with senseCase
tell application "Finder"
set name of file ((target_folder as string) & an_item as string) to (new_name)
end tell
end if
end repeat
beep
display dialog "Script done, doo-dah!"


--
"When it's not necessary to do something, it becomes necessary NOT to do it."


Rich Reardon
Digital Media Center Video Production
Room 540G, Rarig Center, 330 21st Ave. South
University of Minnesota
Minneapolis, MN 55455

email@hidden
Ph: 612-625-3486/Fax: 612-625-4864
http://dmc.umn.edu/video/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: Rip Van Applescript
      • From: Tim Mansour <email@hidden>
    • Re: Rip Van Applescript
      • From: Peter Baxter <email@hidden>
References: 
 >Re: Who is zimbra? (From: "Gary (Lists)" <email@hidden>)

  • Prev by Date: Re: Who is zimbra?
  • Next by Date: Re: Who is zimbra?
  • Previous by thread: Re: Who is zimbra?
  • Next by thread: Re: Rip Van Applescript
  • Index(es):
    • Date
    • Thread