Automator - assign random numbers to file names

Hi,
I have a digital photo frame. Unfortunately it doesn't have a 'random' setting, and therefore my photos all play in sequence.
The second best thing would be to assign a random number to my photos before I transfer them to the photo frame!
Would someone be able to advise how I could set up an automator process to do this?
Thanks in advance!
Matt

The script also doesn't work if there isn't a Finder window open. It won't help you now, but it would be a little bit safer to use something like:
repeat with this_item in (get document files of (choose folder with prompt "Select a folder containing files to rename:"))
I suppose it could have been worse - at least it didn't recurse into subfolders (I don't even want to think about that with a folder full of applications). Of course, if you had been running from a standard account instead of an administrative one... ;p

Similar Messages

  • Automator script search document for file name, and rename file to date

    Hi all,
    I'm having a hard time with Automator... and I can't figure out how it's done!
    Searched the web for it a couple of times, spend hours with Automator already, but I guess my need is random!
    The thing is:
    I got a folder with 1066 files, all the files has random names.....
    I got a document (now it's html, but can convert it to PDF or txt or so ever....) with the coressponding random file names in the html.... some words before that there is the date the photo was taken in this format: 08/25/11
    Now I want somehow make automator search that folder each filename... match it in the document with the filename, and rename the files in the folder to the date the photo's were taken.... and that for all 1066 files.....
    anybody a great idea? Some help? I'm a real newby at Automator scrips!
    thanks

    Have you considered A Better Finder Rename 9?
    A Better Finder Rename 9: The Batch File Renamer for Mac OS X
    Otherwise, what you propose seems to be rather like carving the Pieta using a plastic butter knife. But, if you want, here's one example of a rough algorithm to start ...
    * translate the HTML to ASCII text in this format:  filename (date)
    * read one line at a time from the ASCII file
    * for each line, search the folder for the file
    * rename the file according to the (date)
    BTW, you might avoid a strict renaming according to just the date.
    Best luck with this project.
    JJW

  • Using Automator to Find Date in file name--Help!

    Hey guys,
    I have this automator question.
    Daily I record a radio show. Due to cpu limitations I cannot record it right to AAC. (I use the radio shark) So I record it to aiff format. Radio shark adds in the current date to the file name so I know what date the show is from. What I need to know is if I can get an Automator action to find a file in the Radioshark folder with "Radioshow" and the Current Date in the filename.
    How can I have automator use the current date to search for the file.
    I need the date variable included because sometimes my automator app doesn't delete the old file, so at times the radio shark folder could contain numerous "RadioShow" files.
    Any help appreciated.
    17inch Imac 800Mhz/12 inch PB   Mac OS X (10.4.6)  

    Hey thanks. That did work. A new question. It takes about 60 minutes to import the file. Once the file is imported I would like automator to change the Track Info and put it into a specific playlist.
    Most of the time the file imports but does not finish the actions in automator (the track info and moving it to the playlist). I am assuming that it is "timing out" during the import process. Is there a way to pause the automator actions for 60 minutes after it begins the import process and then completed the subsequent actions?
    Any help appreciated!
    Craig

  • Acrobat adding random characters to file name

    Every so often Acrobat will add random characters to a file name while re-creating a pdf. This has caused an issue with InDesign not recognizing a link needs to be updated due to the file having a new name. Any ideas why this occurs and/or solutions to make sure it does not?

    Every so often Acrobat will add random characters to a file name while re-creating a pdf. This has caused an issue with InDesign not recognizing a link needs to be updated due to the file having a new name. Any ideas why this occurs and/or solutions to make sure it does not?

  • Contact list favorites adds random numbers with no name associated

    I have an iphone 4s that will populate random numbers into my favorites list. After deleting them out, they reappear. They are not associated with anyone in my contact list. Any ideas or resolutions?

    Could someone please assist in restoring all contact info.  The last sync session lost all names associated with numbers and the contacts are now showing as an email address only????

  • How do I stop Illustrator automatically adding numbers to file name when exporting with artboard?

    I need to export with artboard. Illustrator automatically adds a number to my original file name. It won't even let me replace the old file. It is extremely annoying and makes flow with other programs really hard because they can't auto update, since the file name  changes. When you have multiple files, you can't be manually renaming all the time. Anyone knows how to fix this? Thanks.

    This has been discussed a few times, and here is a summary of the usual solutions.
    http://forums.adobe.com/message/2989508#2989508
    What is it EXACTLY you are trying to do. Are you trying to export a single page from filename.ai  and make it filename.psd, (without any number afterwards). In that case you could delete the extra artboards prior to export, and then you won't have to checked use artbaords as there is only one page. Otherwise I would plan ahead so your end result will be filename-01.jpg,  filename-02.jpg, and then everytime you use export artbaords those names will replace.
    I am happy with the function as is, and would prefer to have a serial number automatically after the name when checking use artboards. But sounds liek you and others desire more options and thte ability to turn off adding to the filename.

  • Automator reverses numerical order of file names

    I am using Automator to rename a series of audio files ("Get specified finder items" then "rename finder items"), and make them sequential ("add number to new name". When the script runs the order of files are reversed. The last shall be first and the first shall be last. This may be fine in some circumstances, but not to listen to a story! It is imperative to keep the original order.
    How do I stop it from happening again?
    How do I reverse those that have been done incorrectly?

    It is not clear how you are trying to do the order. Have you tried to select a set of files and then use the arrow buttons to move them in the list? If you select the heading, that will typically reorder the files by that heading and undo everything you had done before.
    You should be able to select groups of files and move them up and down in the list. All of those options appear on your view, so what is the real question?

  • Scanning not adding numbers to file name

    I know most people don't do this but I do and I am wondering if this is a bug or new behavior.
    Snow Leopard.  Using the scan utility, if you use the same name (Scan), it will automatically add sequential numbers if that file is found.
    Lion.  Using the scan utility, if the same name is found, it overwrites it. 
    I scan alot of documents just for safe keeping if I have to go back and look through.  I don't label them, I just scan them.  If Lion is going to require me to add a label, I will have to revert to a different tool.
    Anyone else having this issue or concern?  Personally I don't think it is right to overwrite the scan without a warning.
    Jose

    I'm having the same issue Jose. The previous behavior made it easy to set and go with the scanner and rename or combine later if needed. I contacted Apple Support about it to see if there was some hidden setting for this but they said this is just how it functions now but they have had some complaints about the behavior and it is possible it could be addressed in an update. Let's hope they do.

  • Incremental Numbering for File Names

    I've been trying to wrap my head around this problem all day. So I've found two very helpful scripts on this forum: here and here. The second one works, but I'd like to be able to direct where the files are saving to and I'd like to save them as .tifs. It seems like the first script is exactly the one I want, but when I run it I get the following error (I have CS 5):
    I'm trying to use this as a learning exercise, but man, it's a steep curve.
    Thanks
    jonathan.

    I got the script working. Took out some of the superfluous steps. Here it is in case anyone is curious:
    // This script will save the active document to a folder with an incremental sufix
    // Change the options below to match your needs
    var saveFolder = new Folder( '/D/Civil War/Process/Screen Caps' );
    var saveExt = 'tif';
    var saveSufixStart = '_';
    var saveSufixLength = 3;
    tifOpts = new TiffSaveOptions();
    tifOpts.embedColorProfile = true;
    tifOpts.imageCompression = TIFFEncoding.NONE;
    tifOpts.alphaChannels = false;
    tifOpts.layers = false;
    // End of user options
    //==========================================
    function zeroPad ( num, digit ){
       var tmp = num.toString();
       while (tmp.length < digit) { tmp = "0" + tmp;}
       return tmp;
    var docName = decodeURI ( activeDocument.name );
    docName = docName.match( /(.*)(\.[^\.]+)/ ) ? docName = docName.match( /(.*)(\.[^\.]+)/ ) : docName = [ docName, docName, undefined ];
    var saveName = docName[ 1 ]; // activeDocument name with out ext
    var files = saveFolder.getFiles( saveName + '*.' + saveExt );// get an array of files matching doc name prefix
    var saveNumber = files.length + 1;
    alert("New file number: " + zeroPad( saveNumber, saveSufixLength ));
    var saveFile = new File( saveFolder + '/' + saveName + '_' + zeroPad( saveNumber, saveSufixLength ) + '.' + saveExt );
    activeDocument.saveAs( saveFile, tifOpts ,true ,Extension.LOWERCASE);

  • How Do I Copy File Names & Folders From A Hard Drive To A Word Document?

    Hi Gang:
    This may sound silly but I am having a herd time with the following - seemingly simple task.
    I have data DVD-Rs with audio files organized into folders. Each folder contains audio files related to the folder name.
    I would like to copy the file names and folders from a DVD-R and paste them into a MS Word file. I am just looking to get a listing of files as they appear on the DVD-Rs in their folders.
    The problem is that when I copy and paste, the order changes (seemingly randomly) and the file names are no longer under the folder names. In fact, the whole thing looks to be really random.
    Anybody know how to copy file/folder names from a hard drive or DVD-R to a word document and retain the file/folder structure?
    Thanks!
    LAHD

    There is an even easier method with no Terminal magic required. In the Finder, select all the files you want the names of, press Command-C, switch to Word and press Command-V. Poof, your done.
    If you view the DVD in List VIew, you can expand the folders you want the files for, then select all the files (and their folders if you want them too) and then do the Copy/Paste thing.
    Message was edited by: petrock

  • Counter in file name in receiver file adapter

    Hi,
    I am using FTP, my requirement is to add counter in the file name i.e XYZ001.
    And added to this i can increment the counter till XYZ020, after this i am supposed to start again from XYZ001.It will be some how handled that when i place XYZ001 for the second time , it will not overwrite the earlier one as it will be proccess by that time.
    I could have used addcounter but it doesnt work for FTP:(...also have seen /people/shabarish.vijayakumar/blog/2009/10/05/pixi-maintaining-sequence-numbers-in-file-name-scheme
    Do we have any new feature added in PI 7.1 for handling this.
    Regards,
    Abhi

    thanks shabz..
    Request you to please let me know how to proceed with the first option which you have mentioned i.e,how to create tables and will i be able to start the counter again from xyz001 once i reach xyz020? is there any abap code to be written (wiil be asking SAP counterpart ) or we need to do it in the dynamic configuration udf? Please let me know how to do the same.
    1. Maintain a table in SAP. Use/Code a RFC call to look up the sequence number from this table, incrementing the value after it is read. The result is then used in a dynamic configuration code, and the file name can be generated at that point.
    Will this impact performance ?..mine is a credit card authentication interface and response time is imp...
    Regards,
    Abhi

  • Shortening file names

    Hi all,
    Does anyone know of a way to shorten file names to the same length?
    Here is my problem...
    I receive hundreds of InDesign files named with a common file naming convention. for example ABC001_jobtitle / ABC002_nextjob / ABC003_etc. I use a great software package to automate the majority of the tasks that I need to do in the pre-press environment, to speed up repetitive jobs to pre-flight and produce PDFs for proofing and printing.
    I then end up with a folder of files: ABC001_jobtitle.PDF / ABC002_nextjob.PDF / ABC003_etc.PDF
    What I need to be able to do with Apple script or Automator is to truncate the file names to the same length to remove all the characters AFTER the code so that I end up with files named ABC001 / ABC002 / ABC003 (but NOT renaming them as these codes have to match up to a code on a packing list elsewhere).
    Is this possible? There are plenty of file renaming options within Automator but none (that I can see) that solve this problem.

    I just happen to have an Automator Run AppleScript action that trims file names to the specified number of (leftmost or rightmost) characters and renames the file(s). See if this will do what you want (I recommend testing on some copies):
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 335px;
    color: #000000;
    background-color: #FFDDFF;
    overflow: auto;"
    title="this text can be pasted into an Automator 'Run AppleScript' action">
    on run {input, parameters}
    -- rename Finder items (aliases), keeping the left/rightmost characters in the name
    -- names with fewer characters are not trimmed - errors are skipped
    -- input: a list of Finder items to rename
    -- output: a list of the renamed Finder items
    set output to {}
    set SkippedItems to {} -- this will be a list of skipped items
    -- prompt for the number of characters to keep and set the start and end limits
    display dialog "Enter the number of characters to keep:" default answer "all" buttons {"Cancel", "LeftMost", "RightMost"}
    set {TheButton, TheNumber} to {button returned, text returned} of the result
    try
    set TheNumber to TheNumber as integer
    on error
    set TheNumber to "all"
    end try
    if TheNumber is "all" then
    set {TheStart, TheEnd} to {1, -1}
    else
    if TheButton is "LeftMost" then
    set {TheStart, TheEnd} to {1, TheNumber}
    else
    set {TheStart, TheEnd} to {-TheNumber, -1}
    end if
    end if
    tell application "Finder" to repeat with SomeItem in the input -- step through each item in the input
    -- get the item name and extension
    set {TheName, TheExtension} to {name of SomeItem, name extension of SomeItem}
    set TheContainer to (container of SomeItem) as text -- the containing folder
    if TheExtension is in {missing value, ""} then
    set TheExtension to ""
    else
    set TheExtension to "." & TheExtension
    end if
    set TheName to text 1 thru -((length of TheExtension) + 1) of TheName -- the name part
    try
    set FileName to (text TheStart thru TheEnd of TheName) & TheExtension
    set name of SomeItem to FileName
    set the end of output to (TheContainer & the result) as alias
    on error
    set the end of SkippedItems to (return & TheName & TheExtension)
    end try
    end repeat
    if SkippedItems is not {} then -- handle skipped items
    set TheCount to (count SkippedItems) as text
    display alert "Error with renaming files" message "The following " & TheCount & " items(s) were skipped:" & return & SkippedItems as text
    end if
    return the output -- pass the result(s) to the next action
    end run
    </pre>

  • Scanning a document with sequential file names

    I have multiple documents every day that I need to scan into PDF format. Is there a way for me to scan the doucment and have Acrobat assign the next sequential file name and save it to a designated directory? I'd like to do it by using a self feeding scanner and not have to go to the computer each time we have to scan something.
    We are using Acrobat Professional 7.0 with Windows XP.

    I have two different scanners and epson and a cannon, each has software
    that will scan to pdf and seguentially number scans.
    Mike

  • Automator: Create folder from suffix of filename and put file names with same suffix into folder

    I've been using a script to use automator to create a folder from the filename and put that file into it the folder just created.
    I have a bunch of files that have similar names to them, but I don't want every file to be put into its own folder, instead I want all files with the same suffix (001) to go into the same folder.  I would also like the folder name to just be named the same as the suffix (001) instead of the full file name.
    For example all of these files names that end with the same integer (001) should be dumped into the same folder named "001":
    Boston_ProRes422_1920x1080_24p_Audio_001
    Boston_ProRes422_3840x2160_24p_Audio_001
    Boston_ProRes422_3840x2160_24p_RAW_Audio_001
    Boston_ProRes422_1920x1080_24p_Audio_002
    Boston_ProRes422_1920x1080_24p_Audio_005
    Boston_ProRes422_1920x1080_24p_Audio_010
    Any help at all would be incredible!!
    Thanks!
    Here's the script I'm using right now:
    on run {input, parameters} -- create folders from file names and move
      set output to {} -- this will be a list of the moved files
      repeat with anItem in the input -- step through each item in the input
      set {theContainer, theName, theExtension} to (getTheNames from anItem)
      try
      set destination to (makeNewFolder for theName at theContainer)
      tell application "Finder"
      move anItem to destination
      set the end of the output to the result as alias -- success
      end tell
      on error errorMessage -- duplicate name, permissions, etc
      log errorMessage
      # handle errors if desired - just skip for now
      end try
      end repeat
      return the output -- pass on the results to following actions
    end run
    to getTheNames from someItem -- get a container, name, and extension from a file item
      tell application "System Events" to tell disk item (someItem as text)
      set theContainer to the path of the container
      set {theName, theExtension} to {name, name extension}
      end tell
      if theExtension is not "" then
      set theName to text 1 thru -((count theExtension) + 2) of theName -- just the name part
      set theExtension to "." & theExtension
      end if
      return {theContainer, theName, theExtension}
    end getTheNames
    to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
      set theParent to theParent as text
      if theParent begins with "/" then set theParent to theParent as POSIX file as text
      try
      return (theParent & theChild) as alias
      on error errorMessage -- no folder
      log errorMessage
      tell application "Finder" to make new folder at theParent with properties {name:theChild}
      return the result as alias
      end try
    end makeNewFolder

    Thanks Neil for the response! That script didn't work, but I did get it to work with my old script by changing "set TheName to" numbers different.  Here's my final script which creates folders named "001", "002", and so forth and dumps in the files that end in that same suffix in the matching folder.
    on run {input, parameters} -- create folders from file names and move
      set output to {} -- this will be a list of the moved files
      repeat with anItem in the input -- step through each item in the input
      set {theContainer, theName, theExtension} to (getTheNames from anItem)
      try
      set destination to (makeNewFolder for theName at theContainer)
      tell application "Finder"
      move anItem to destination
      set the end of the output to the result as alias -- success
      end tell
      on error errorMessage -- duplicate name, permissions, etc
      log errorMessage
      # handle errors if desired - just skip for now
      end try
      end repeat
      return the output -- pass on the results to following actions
    end run
    to getTheNames from someItem -- get a container, name, and extension from a file item
      tell application "System Events" to tell disk item (someItem as text)
      set theContainer to the path of the container
      set {theName, theExtension} to {name, name extension}
      end tell
      if theExtension is not "" then
      set theName to text -5 thru -((count theExtension) + 4) of theName -- just the name part
      set theExtension to "." & theExtension
      end if
      return {theContainer, theName, theExtension}
    end getTheNames
    to makeNewFolder for theChild at theParent -- make a new child folder at the parent location if it doesn't already exist
      set theParent to theParent as text
      if theParent begins with "/" then set theParent to theParent as POSIX file as text
      try
      return (theParent & theChild) as alias
      on error errorMessage -- no folder
      log errorMessage
      tell application "Finder" to make new folder at theParent with properties {name:theChild}
      return the result as alias
      end try
    end makeNewFolder

  • Help with importing photos - IPhoto assigning file names that already exist

    When I import photos from my canon powershot camera, IPhoto has begun assigning file names that are the same as filenames that already exist on photos imported previously. It appears it is deleting those older files (when I go look in my photo library, the older one with the same name is now gone).
    I don't know how to name photos as they are imported as it seems to be done automatically and I'm afraid to import more photos and loose my old pics. Can't find anything on the internet when I search on this question - can anyone help?

    Thanks so much for your quick reply, TD.
    What happens when I plug in my camera is that Iphoto opens, asks me if I want to import photos (and if I want to delete originals), and I click okay or whatever and they are imported. I name the roll/folder, and I photo puts them in the library in that folder in that year.
    It makes sense that the camera is numbering them. I think that the ones it is using the same numbers for (ie - IMG0080.jpg) are the numbers on older photos that were assigned by a different camera that we used to have.
    So I guess the canon isn't searching on all photo names that have been used, just the ones that it has used in the past.
    Unfortunately, when the new photo is named with the same name as an old one, that old one is literally deleted - at least as far as I can tell - and when I go look for it in my photo library, it is no longer there.
    I might try to see if there are any help forums for the canon powershot and see what I might learn there.
    THanks so much for your help!

Maybe you are looking for