6 Replies Latest reply: Oct 23, 2013 11:14 AM by Goody7
Goody7 Level 1 Level 1 (0 points)

Hello,

 

I want to use an apple script that, when run, will selet all the images in a folder that have the same unique image # (different counter #'s obviously).  In other words, I tell it to look for # XYZ and it selects them all for me.  I know it almost sounds pointless, as I could do a search querie, or arrange by name, date, etc ... But I'm often faced with folders of hundreds of images with very unique ID #'s that have no chronological-like delimiters and that don't include a date.  I.E., dk83928ijd9.0034.jpg.  I want to be able to simply run a script that quickly selects the ones I tell it to, so that I can then perform other scripts or actions on them, or simply drag them somewhere - or even use the apple script in an automator action.  Does that make sense?  Anyone have anything.  Thanks!!


C


GarageBand (Mac) '11, Mac OS X (10.6.8)
  • 1. Re: Apple script for selecting images in a folder
    Frank Caggiano Level 7 Level 7 (23,840 points)

    Your question is a bit vague. This script will select all files in the Desktop that have the extension m4r

     

    tell application "Finder"

      activate

              set parentFolder to (path to desktop)

              select (every item of parentFolder whose name extension is "m4r")

    end tell


     

     

    This ine will select all files whose name contains "titlle"

     

    tell application "Finder"

      activate

              set parentFolder to (path to desktop)

              select (every item of parentFolder whose name contains "title")

    end tell


  • 2. Re: Apple script for selecting images in a folder
    Goody7 Level 1 Level 1 (0 points)

    cool, thanks.  How do i code it to run on a specific folder, on the desktop or on a hard drive/server, or in a capture 1 session folder?

  • 3. Re: Apple script for selecting images in a folder
    Frank Caggiano Level 7 Level 7 (23,840 points)

    So do you have any Applescript experience?  The scripts as show run on the Desktop folder

    set parentFolder to (path to desktop)

    To have it run on a different folder you could hardcode the path in or you could prompt the user for the folder to run on.

     

    There are a lot of good resourses for learning Applescript two off the top

     

    Introduction to AppleScript Language Guide

    macscripter.net

     

    Learn AppleScript is a very good book. Both as a tutorial and a refernce

     

    Google will find a lot more.

     

    regards

  • 4. Re: Apple script for selecting images in a folder
    Goody7 Level 1 Level 1 (0 points)

    Thanks man.  Nope, obviously I have very little applscript experience, only enough to tweak a script here and there. But trying to learn.  Will check out those links.  Thanks again!

  • 5. Re: Apple script for selecting images in a folder
    Frank Caggiano Level 7 Level 7 (23,840 points)

    changing the script to

     

    set searchText to "IMG"

     

    set parentFolder to choose folder with prompt "Select the folder:"

     

    tell application "Finder"

      activate

              select (every item of parentFolder whose name contains searchText)

    end tell


    will ask the user for the folder to search for files whose name contains 'IMG". Modify the IMG to what you are searching for. Just leave the quotes there.

     

    I highly recommend the book I linked to if you are serious about learning Applescript. The price is a bit steep but it does cover a lot of ground and is one of the few texts I've found that gives a good description of Applescript / Objective-C.

     

    good luck

  • 6. Re: Apple script for selecting images in a folder
    Goody7 Level 1 Level 1 (0 points)

    Cool, this script is probably more ideal, as you can simply prompt for the folder instead of having to modify the script.  Thaks man.  Much appreciated.  I will check out that book.  Need to learn some of this as I realize how helpful it can be!!

     

    C