Go Back   The macosxhints Forums > OS X Help Requests > Applications



Reply
 
Thread Tools Rate Thread Display Modes
Old 04-12-2009, 08:58 PM   #1
Pizz
Prospect
 
Join Date: Dec 2007
Posts: 20
Applescript for sequentially numbering files??

Anyone know where I can find a script to add a sequential prefix number to files in a folder?
(ie: 01_image.jpeg, 02_otherimage.jpeg, 03_anotherimage.jpeg)
Pizz is offline   Reply With Quote
Old 04-12-2009, 09:38 PM   #2
NaOH
Hall of Famer
 
Join Date: Dec 2007
Posts: 3,790
If you don't require Applescript (of which I'm no help), you may want to consider the donationware Name Mangler since it can number files sequentially.
NaOH is offline   Reply With Quote
Old 04-12-2009, 09:43 PM   #3
wiz722
Prospect
 
Join Date: Apr 2009
Posts: 3
If an Automator Workflow is OK (vs. an applescript), you can do it by making an Automator Workflow fairly easily. If you really want an Applescript, I can write one for you and paste the required code into a new post.

I will give you a workflow for now, since I can make it faster. I will list in text form what Automator Actions you need to add in the following example action:
==========================================================================
TITLE (same as name of action in Automator Library)
--------------------------------------------------------------------------
Options: (any description of what you need to configure in the current
automator action to make it work correctly.)

Here is an Automator Workflow you can try:

==========================================================================
ASK FOR FINDER ITEMS
--------------------------------------------------------------------------
Options:
- Optional: set "start in" folder to a different folder
- Check "Allow Multiple Selection"
==========================================================================
RENAME FINDER ITEMS
--------------------------------------------------------------------------
Note: It is your choice if you want to copy the files before modifying them.
If you do, there will be a third action in this workflow, before this one
but after the first one shown here.
Options:
- Set first drop-down box to "Make Sequential"
- Click radio button ("circle") next to Add number to existing item name
- Set "Place number" to "before name"
- Set "start numbers at" to the number you want to start the count at
- Set "separated by" to "underscore" (this will insert a "_" after each number)
- Optional: if you want the numbers the same length, check "Make all numbers"
and set the length.
- Look at the example at the bottom to see if the format is correct.



Then just run it! When the file selection box shows up, use the shift key to select a continuous list of files, or command to select each file you click.
wiz722 is offline   Reply With Quote
Old 04-13-2009, 08:07 AM   #4
Pizz
Prospect
 
Join Date: Dec 2007
Posts: 20
That Name Mangler app is great.

The Automator workflow is what I needed! Thanks I have to use automator more often
Pizz is offline   Reply With Quote
Old 04-13-2009, 10:31 AM   #5
Cheech'i
Major Leaguer
 
Join Date: Mar 2006
Posts: 432
I use Automator for this and have a generic 'batch rename' so that I can name files what I want instead of a pre-determined string like Applescript would give.

There is probably a way to add a dialog input to an applescript but I have always found you give it a parameter and it starts from there. Popular ones that I've seen use a timestamp.
__________________
Maybe the light at the end of the tunnel is you.
Cheech'i is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

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



All times are GMT -5. The time now is 10:54 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.
Site design © IDG Consumer & SMB; individuals retain copyright of their postings
but consent to the possible use of their material in other areas of IDG Consumer & SMB.