Applescript image filenames to spreadsheet

I'm a long time mac user but just recently discovered Applescript, TODAY! Looks amazing so far but I need some help to accomplish a simple (I think) task.
I have a spreadsheet in numbers full of products (sku, price, blah blah blah). I have a folder full of images for all these products. The images are titled beginning with the sku followed by extra info like a _1 or _detail or -closeup etc.
I want to basically create a script that will go through this spreadsheet, look at the SKU in each row, then find all the related image files within a specific folder (folder has subdirectories) and insert all matching filenames into a column next to the SKU, separated by a semicolon.
For example,
sku
gallery_images
abcd1234
abcd1234.jpg;abcd1234_1.jpg;abcd_detail.png;abcd_closed.gif
defg5678
defg5678.png;defg5678_2.jpg;defg5678-lifestyle.jpg
hijk91011
hijk91011.jpg;hijk91011-2.jpg;hijk91011-5.jpg
Any and all help would be much appreciated.

I tried this here with a sample folder.... seems to work...
so you select the lines you want to process with the script (columns sku and gallery_images) and the script overwrites the cells in "gallery_images" column with all found filenames....
--14.09.2011 hubionmac.com
-- parts of numbers selection code by http://hints.macworld.com/article.php?story=20090109055630154
-- requested @https://discussions.apple.com/thread/3325583?tstart=0
-- this script takes the value of a selection in numbers first and a asks for a folder
-- then the values of the first column of the selection are taken and all filenames of start start with that folder and are found in the defined folder will be
-- writen to the last column of the selection ----> you will have to select at least 2 columns
set thefolder to quoted form of POSIX path of ((choose folder) as alias)
tell application "Numbers"
activate
tell document 1
-- DETERMINE THE CURRENT SHEET
set current_sheet_index to 0
repeat with i from 1 to the count of sheets
tell sheet i
set x to the count of (tables whose selection range is not missing value)
end tell
if x is not 0 then
set the current_sheet_index to i
exit repeat
end if
end repeat
if the current_sheet_index is 0 then error "No sheet has a selected table."
-- GET THE VALUES OF THE SELECTED CELLS
tell sheet current_sheet_index
set the current_table to the first table whose selection range is not missing value
tell the current_table
set range_column_count to count of every column of selection range
set this_rows_first_cell_index to 1
set this_rows_last_cell_index to range_column_count
-- THIS CHANGES THE VALUE OF
repeat with i from 2 to count of every cell of selection range
set thename to value of cell this_rows_first_cell_index of selection range
set foundfilenames to my find_filenames(thefolder, thename)
set value of cell this_rows_last_cell_index of selection range to foundfilenames
set this_rows_first_cell_index to this_rows_first_cell_index + range_column_count
set this_rows_last_cell_index to this_rows_last_cell_index + range_column_count
if this_rows_last_cell_index > (count of every cell of selection range) then exit repeat
end repeat
end tell
end tell
end tell
end tell
on find_filenames(thefolder, filename_start)
-- THIS SEARCHES FILES STARTING WITH A SPECIFIC STRING IN THEIR NAMES AND OUTPUTS JUST THEIR FILENAMES
-- IS SEARCHES IN THEFOLDER AND ALL SUB-DIRECTORIES
set theoutput to do shell script "find " & thefolder & " -iname \"" & filename_start & "*\" -exec basename {} \\;"
if theoutput ≠ "" then
set theoutput to every paragraph of theoutput
set AppleScript's text item delimiters to "; "
set theoutput to theoutput as text
set AppleScript's text item delimiters to ""
end if
return theoutput
end find_filenames

Similar Messages

  • How do I resequence image filenames in an iPhoto event?

    My system configuration:  iMac i7 (2013), OS X Yosemite 10.10.1, current iPhoto app,  all updates installed, and iPhone 6 Plus.
    Within an event in iPhoto on my iMac, I have 300 photos.  I have taken photos at various times within a two year period.  After taking the photos I imported them into the iPhoto event whenever it was convenient.  Now I have many photos in that particular event that have various unsequenced image file names such as IMG_0250, IMG_0262, IMG_0271, etc, etc.  I am worried that sometime a photo that I take with my iPhone 6 Plus will have a duplicate image filename again such as IMG_0262.  I do not want the duplicate IMG_0262 on the iPhone to overwrite the previous IMG_0262 file on the iMac.  Since my photo filenames are unsequenced, I would like to sequence them and begin their names with IMG_0001, IMG_0002, etc, etc.  I resequenced the image names once before in another event, but do not remember the procedure I used.  Can someone please assist this old man.  Thanks

    1. These are filenames created by your camera, not image titles.
    2. A new photo with the same name will not ever overwrite another one. The file management on iphoto is smarter than that.
    3. You can change the title of a photos using the Photos -> Batch Change command.

  • Why doesn't Photos display image filename?

    Updated to Photos but found that whereas before one could display information beneath each image now there is no way to show the filename or the date of a picture. Over the years I have changed image filenames so that I can quickly find specific images and having the dates visible makes for easy classification without having to create loads of albums etc etc and then move stuff around. It would be nice if Apple didn't remove functionality when replacing software.

    Because there is no need for the file name - it is of no use
    and if you have been using iPhoto you have never changed a file name
    By default both iPhoto and Photos set the title to the file name if there is no title in the MetaData - but changing the title has no effect on the file name - in either program it is not possible to change file names
    In Photos you can see the title in the info window - if you want it below the photo request that apple add that option
    LN

  • Photos do not show in Messages - Only show as image filename

    For a long awhile now on Messages has not been handling images sent to me properly.
    All that shows up on Messages on my MBP (now running Yosemite) when someone sends me a message is the image filename (example: IMG_0456), with a little Preview icon to the left.
    Before the image used to show up on my Messages app on the MBP. Now, even clicking to open the image filename, just brings up a little dialog box with a larger Preview icon and the size of the image.
    In order to view images sent to me, I have to check them on my iPhone.
    I was hoping the Yosemite upgrade would fix this, but it seems to not have, and numerous searches for answers brings up no results. I have no idea when this started as it happened awhile ago.

    I have an early 2014 MBP (4th gen i7, 16 GB of RAM, IRIS Pro graphics) and am having the same issue. Attachments that could show previews displayed properly in Mavericks. If someone sent me a video, I could watch that video inline. If someone sent me a picture, I could see a preview right in the messages window, and double-click the image to view it at full-size / potentially open in Preview if I wanted to. Now, after upgrading to Yosemite, I too only see the filename of the attachment, and if I double-click it, a window displays with the filename, file type, and date created.
    This is obviously a problem.
    Has anyone figured out a way to fix this issue?
    Screens --
    Message received in Messages app: https://www.dropbox.com/s/ovoi3wjy9uldpah/Screen%20Shot%202014-10-26%20at%204.20 .55%20PM.png?dl=0
    Modal window showing attachment details: https://www.dropbox.com/s/g7s0wke719dprbx/Screen%20Shot%202014-10-26%20at%204.21 .20%20PM.png?dl=0
    Thank you guys for your time!
    --Mitch

  • Link image filename to text.

    Hi, I am making a catalog and I have it in a basic format. Image of product first, underneath it is ProductID + Price.  The image filenames are formatted with the d of the product. How can I link it so in my catalog where is says ProductID: to have a string or variable after so that it will auto. take the file name of the above product and put in the id without .jpg following. I have tried but there is not even one way I can think of other then a simple link to the text box and the image box, there should be a feature to create any variable you like.

    In the sample scripts there is one called LabelGraphics which might work as a starting point (I've never used it myself). You could then run a series (if more than one format is involved) of GREP Find/Change queries to remove the extensions from the file names.

  • How to get image filename in indesign cs3

    Hi,
        I want to get a filename of a selected rectangle frame graphic child item like tiff image or pdf file. Please help me with a code snippet.
    Thanks,
    K.Saravanan.

    app.activeWindow.activeSpread = myDocument.spreads[j];
    app.activeWindow.zoom(ZoomOptions.FIT_SPREAD);

  • Can a script be written to take the next 2 files in a folder and place them on a background image..then saving with the first images filename..?

    Hello all, I hope you can help.
    In Photoshop I have a problem to overcome and have delved into the world of scripting..
    If there is a quick way to produce the following could someone help me with some pointers?
    Here is my situation..
    I need to produce a photograph proof card, these are for a double image option so cause me a headache compared to just creating an action..
    This proof card really is just a set of two different photographs placed onto a background image.
    I would produce two different images of the same person and name them exactly the same except they are suffixed with an A or B to keep them together, these would be in a folder with approx 500 other images for example (250 x two of each person)
    My preference for the process would be done in the following sequence:
    1/ Open the background file jpg (which is sized at 2400 x 1800 pixels @ 300dpi)
    2/ Load the first image from the batch file and place this.
    3/ Get the filename of the first image and create it as a text layer and write it below the image at 10 point text size.
    4/ Create another copy of this layer and change the font to 3of9barcode font, however the font needs an asterisk before the text then again after it. e.g. *filenameA*
         Only the first image has the need for a barcode as they are for the same person. This is at 18 point.
    5/ Load the next sequential image from the batch file and place this.
    6/ Get the filename for the second image and as Item 3/ create a text layer below at 10 point text size.
    7/ Place a png overlay with my copyright information over the images (I need to do this twice, once for each image)
    8/ Flatten the images and save the file in a new folder with the same filename as the first image.
    I can do this in Lightroom with the exception of putting the barcoded text, and the filenaming, this is because the background image is used as the identity plate and the filename is not based on the data from either photograph..
    Can anyone shed some light on where to go from here?
    Kind regards
    Bryan

    Photoshop Scripting-wise this seems fairly "easy".
    But I would recommend creating a template file (that already combines background image, png overlay and the Type Layers).
    Maybe data driven graphics would also be an option …
    Photoshop Help | Creating data-driven graphics

  • Exposing the Image Filename in Bridge Full Screen Preview?

    While in the "Full Screen Preview" if I enter "5" on the numeric keypad the filename and five stars appear in the lower-left hand portion of the screen.
    Is there any way to make the filename appear without entering a label value?  (if the image was already rated, entering a "5" would overwrite the original image rating)
    Thanks!
      brian

    Thanks Yammer, but the same issue holds.  The picture appears, but no filename (or rating) until you assign a rating (by hitting the numeric "9", for instance), and then the filename and rating remain as you view other pictures.
    I am simply looking for a way to have the filename be present without having to apply a rating (which would have the adverse affect of overwriting the existing rating).
    THANKS!
      Brian

  • Image filename description in PDF

    Hi,
    I have a converted powerpoint file which is showing up the original jpeg filenames when you mouse over the images in the PDF which i would like to remove or edit as they are just nonsense rather than a proper description.
    I have looked in acrobat but I cannot find where it shows them up, can anyone help on this please,
    I am using a PC version of version 9.
    Ta muchly
    Simon

    Hi Dean,
    Here is a sample of the image issue: https://acrobat.com/#d=EGVpC0TT2iHGyNXPUqWmCw
    You can create/drag buttons from the Object Library onto the page. Then in the custom appearance you can set the fill and border to the look and feel you want.
    In LC Designer, make sure that in the File > Form Properties > Defaults tab, you set 'preserve script changes' to automatic.
    Also the object should have a 'normal' or 'name' binding in the Object > Binding palette. It depends on which version of LC Designer you are using.
    When deploying forms it is important to consider what your users will open the form with - Acrobat or Reader. Here is a summary of what features are available depending on what the user has and whether the form has been Reader Enabled:
    A summary and PDF is here:
    http://assurehsc.ie/blog/index.php/2010/05/using-livecycle-forms-in-acrobat-and-reader/
    There are two ways to Reader Enable the form: using Acrobat OR using the full server product LC Reader Extensions ES2. Come back if you need more info.
    Good luck,
    Niall

  • How to revert to original image filenames in acr?

    Setup is Photoshop CS4 on Apple platform. ACR was used to batch rename a group of images with the option to preserve original filename in xmp activated. Due to an error when renaming, I now wish to have a few files revert to their original filename. I can't find any info on how to do this. Any help greatly appreciated!

    Anyone please help me, how to find out the embedded image resolution in illustrator file through script.
    Thanks,
    Prabudass

  • Image Filename - Relative Location

    Hi, I am a pretty new programmer, and ran into a situation where I feel pretty stuck. I have a program that involves putting an image on the screen. Currently, I have a static filename: "C:/Program Files..." I want to be able to move a folder with my program and the image around onto multiple computers, but I don't want to have to change the filename every time I do so. Imagine that my the java file is in the same folder as the picture. Is there a method I can call to retrieve the location of file I am running? (If it matters, it is an application)
    Please let me know if there is any more information i need to provide.
    Thanks in advance for any help you can give.
    private class MainPanel extends JPanel {
         public void paintComponent(Graphics g) {
              super.paintComponent(g);
              Graphics2D g2D = (Graphics2D)g;
              Image i = Toolkit.getDefaultToolkit().getImage("C:/Program Files/Folder/Picture.jpg");
              g2D.drawImage(i, 100, 210, this);}

    There is a class called Class which has a method getResource(). This method returns a URL based on the name you supply as an argument. This URL can be used to load resources like images - for instance there is a version of the toolkit getImage() method that uses a URL rather than a filename.
    http://java.sun.com/javase/6/docs/api/java/lang/Class.html#getResource(java.lang.String)
    http://java.sun.com/javase/6/docs/api/java/awt/Toolkit.html#getImage(java.net.URL)
    The API documentation describes precisely how resources are found but, roughly speaking, they are located in the same place as the class file. This can "move around", or even be placed inside a jar file and the image will still load.
    Class provides a static method that lets you get an instance of Class (to load resources with) based on the class name: likeClass cls = Class.forName("MainPanel");Or you can use getClass() with an instance of a particular classpublic void paintComponent(Graphics g) {
        super.paintComponent(g);
        Image i = Toolkit.getDefaultToolkit().getImage(getClass().getResource("Picture.jpg"));
        // etc
    }(Haven't tested this - and I don't think you should really load the image every time paintComponent() is called. All sorts of exceptions can be thrown, so you may want to break that long line up a bit.)
    http://www.exampledepot.com/egs/java.lang/GetClass.html

  • Image filename

    Hi all,
    I will like to know whether it is possible to get the filename of the image that is set within a label. That means the label actually contains an image in which I want to obtain the filename of the image. Anyone knows how to code this?
    Thanks!

    flounder wrote:
    I would query why you actually need the filename in the first place.Me too.
    But if you must, try getting the Icon from the Label, cast it to an ImageIcon and see if you can get the info from it's methods. Perhaps toString() may provide details.Or capture the filename from the start, when you add it to the initial label, and make it a client property. When you're handling the drag, also grab that client property. (I've assumed you're talking about Swing widgets here)

  • Slideshow and image filenames

    Hi, is there a way to display each image's filename on the slides generated by the Slideshow module in LR1.1?
    Thanks for any help,
    DLMST

    Thank you, I tried using the ABC feature but it added the same text to EVERY slide. I couldn't figure out how to apply the text to each slide independently. (I do use that feature to add copyright and contact url applied to all slides however.) There must be something I'm doing incorrectly. :-( I'll re-read the LR Help.

  • Corrupt image filenames

    I'm not sure if this is a TimeMachine/TimeCapsule problem or an iPhoto problem.
    About 4 weeks ago, I installed a TimeCapsule and started backing up my machine via TM/TC. About 2 weeks ago I've noticed that a large number of my photos within iPhoto are missing (thumbnail exists but attempting to display the photo or edit it shows a large exclamation mark !). Attempting to show the original or current file fails to locate the file within the iPhoto collection of folders. Browsing the underlying physical directories within iPhoto via bash shows that a large number of files (4000+) have been renamed from their original imported name (DSC_xxxx.jpg) to an unintelligible style of name (090C008F-52AD-4E97-8885-6C441B8FB9D4-2241-00000C14CF31EB86) with no file extension. The problem is occurring for both jpg and NEF files. iPhoto is still looking for the original name and I need to restore these links if I want to preserve meta data and touch ups done via iPhoto (collection is 17000+ photos). I have taken a copy of my iPhoto library to stop any further destruction.
    Has anyone seen this problem before or know how I might prevent it from occurring again?
    Thanks.

    yogi3121
    This suggests to me that you have an issue with your Hard Disk.
    These files are identifying themselves to the Operating System as cache files rather than image files. I know of no reason why (or how) either iPhoto or Time Machine could do this to these file. Hence my next suspect is the HD.
    This library is toast. The files have been renamed, and unless you can rename them back to what the were (unlikely?) then iPhoto has no way of being re-attached with them.
    1. Check your HD thoroughly.
    2. If you're happy that it's in an okay condition you need to start over with a new library.
    3. You can try renaming these files with a batch renamer such as Name Mangler. Include the .jpeg or .nef suffix as appropriate
    4. To create and populate a new library:
    Note this will give you a working library with the same Events and pictures as before, however, you will lose your albums, keywords, modified versions, books, calendars etc.
    In the iPhoto Preferences -> Events Uncheck the box at 'Imported Items from the Finder'
    Move the iPhoto Library to the desktop
    Launch iPhoto. It will ask if you wish to create a new Library. Say Yes.
    Go into the iPhoto Library (Right Click -> Show Package Contents) on your desktop and find the Originals folder. From the Originals folder drag the individual Event Folders to the iPhoto Window and it will recreate them in the new library.
    When you're sure all is well you can delete the iPhoto Library on your desktop.
    In the future, in addition to your usual back up routine, you might like to make a copy of the library6.iPhoto file whenever you have made changes to the library as protection against database corruption.
    Regards
    TD

  • In Organiser, can the image filename be shown below the thumbnail (RAW CR2 files)?

    In Organiser, is it possible to display the fiename below the image thumbnail (RAW CR2 files)?

    Okay! Fixed now... after a little more digging, it turns out I wasn't putting the CR plug-in into the root folder....
    Schoolboy error....
    Thanks anyway!
    Ben

Maybe you are looking for

  • Ipod touch can no longer connect to XP following Apple upgrade, HELP !

    This is a nightmare. My son has an ipod touch (8gb)purchased a couple of months, and it's been fine until a couple of days ago. I downloaded some music for him, and just about to synch when Apple informed me on itunes of a software upgrade, so natura

  • How do i connect my iPod touch to a new Laptop/Pc ?

    When i plug my iPod into my pc and try and get it to connect to iTunes it doesn't connect and does not show 'Cieran's iPod' (Name of iPod) under iTunes Store. ? My laptop that use to connect to my iPod and had all the data on, has now broke and i'm t

  • Reverting to Edge from Wifi

    I've had my iPhone for 3 days. I cannot get it to stay on WiFi. It shows a check by my home WiFi (I've logged in with the WEP) but the "E" shows in the corner. I've reset the network connections and "forgotten" the network and re-connected. It still

  • I have a IMAC 24" WITH VIDEO BOARD PROBLEM.

    YEAR 2007 WEEK 12th. S/N CK******VGP. Apple told me that this model is VINTAGE so i can't find a new VIDEO BOARD. Is it true? where can i buy it? Thanks a lot. Gio <Edited by Host>

  • Websites do not have the https anymore.  Did I get hit?  What to do?

    I tried to save a jpg from a site, then the screen became that image. Now most sites I have checked out do not have the https padlock anymore. Have I been hit? What do I need to do now?