Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 7, 2006, 06:10 PM   #1
t0ast
Registered User
 
Join Date: Sep 2004
Changing filenames with Apple Script

I like to keep my replay section for Warcraft III clean, so I was editing loads of filenames when I suddenly realized it could be done so much faster with an Apple Script. Sadly however, I hardly know anything about apple script. I found a sample script made by Apple, but I'm unable to tamper with it to adapt it to my needs.

Basically, I need the applescript to move segments of a filename.

I have a great amount of replays named either [xxxxxxxxx]-player1(y)-vs-player2(y).w3g or [xxxxxxxxx]player1(y)-vs-player2(y), where x is the match-ID and y is the players race.

[wcr20060205]WE_IGE_Sweet_(U)_4K_Grubby_(O)_4.w3g:
The filename as a whole could be divided into three segments:
The match-ID: "[wcr20060205]"
Players & races: "WE_IGE_Sweet_(U)_4K_Grubby_(O)_4"
extension ".w3g

What I want the script to do, is to move the ID in the brackets, and the brackets itself behind the players.

Example:
[wcr20060205]4K_Grubby_(O)_WE_IGE_Sweet_(U)_5.w3g transfers into
4k_Grubby_(O)_WE_IGE_Sweet_(U)_5[wcr20060205].w3g

[Replayers56402]-strifecro(NE)-vs-rara.(HMN).w3g transfers into
-strifecro(NE)-vs-rara.(HMN)[Replayers56402].w3g


Thanks in advance, cheers.

Attachment: Sample script in .txt format from Apple to change filenames, might come in handy.

EDIT:
Problem solved, shell scripting ftw
Code:
echo "[wcr20060205]4K_Grubby_(O)_WE_IGE_Sweet_(U)_5.w3g" | sed -e "s/\(\[.*\]\)\(.*\)\./\2\1./"
---> 4K_Grubby_(O)_WE_IGE_Sweet_(U)_5[wcr20060205].w3g
Attached Files
File Type: txt Filenamescript.txt (4.4 KB, 31 views)

Last edited by t0ast; Apr 7, 2006 at 07:30 PM.
t0ast is offline   0 Reply With Quote
Old Apr 8, 2006, 07:46 AM   #2
Soulstorm
macrumors 68000
 
Soulstorm's Avatar
 
Join Date: Feb 2005
look in my homepage for Finder Utility. It is an applescript application that will suit your needs.
Soulstorm is offline   0 Reply With Quote
Old Apr 8, 2006, 08:59 AM   #3
BakedBeans
Banned
 
BakedBeans's Avatar
 
Join Date: May 2004
Location: What's Your Favorite Posish
Not sure if you have Tiger or not but Automator would be easier surely?
BakedBeans is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Iphone 3GS 4.1 Baseband 6.15 stuck with Apple logo joden007 Jailbreaks and iOS Hacks 4 Feb 27, 2012 11:11 PM
Need help with apple script to do with creating random numbers! Geoffrey Readin Mac Programming 0 Jan 13, 2011 10:52 AM
games with apple script? pats-madin Mac Programming 5 Jan 6, 2008 10:13 PM
Mounting network drives with Apple Script, sometimes fail techmonkey Mac Programming 3 Jul 5, 2007 08:56 AM
Help with Apple Script beatle888 Mac Help/Tips 6 Oct 24, 2002 02:32 AM


All times are GMT -5. The time now is 04:55 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC