Set a file icon from image file of same name

I have a folder of files and I have another folder of images that have the same names as the files. What I would like to do is apply an icon of each image to it's corresponding file. Is this possible? Any help would be greatly appreciated.
Ian

IanWfsdafeqry rasrbd wrote:
I have a folder of files and I have another folder of images that have the same names as the files. What I would like to do is apply an icon of each image to it's corresponding file. Is this possible? Any help would be greatly appreciated.
That reminds me of the question asked by Fierabras in this thread.
If both of your folders contain exactly the same number of files, and if the names of the files are the same in both folders (except the name extension of course), then the following script should do what you are asking for, though admittedly not in the background.
(The script seems to work flawlessly on my MacBook Pro under Mac OS X 10.8.)
tell application "Finder"
    set folder1 to folder POSIX file "/POSIX/path/to/folder/of/images"
    -- for example: "/Users/me/Desktop/My images"
    set folder2 to folder POSIX file "/POSIX/path/to/folder/of/files"
    -- for example: "/Users/me/Desktop/My files"
    set N to (count folder1)
    if not (count folder2) = N then return
    set theImages to files of folder1
    set theFiles to files of folder2
    tell application "Image Events" to launch
    repeat with k from 1 to N
        set thisImageFile to item k of theImages
        tell application "Image Events"
            set theImage to open thisImageFile as alias
            save theImage with icon
            close theImage
        end tell
        tell application "Finder"
            activate
            set infoWindow1 to open information window of thisImageFile
            tell application "System Events"
                keystroke tab
                keystroke "c" using command down
                keystroke "x" using command down -- optional
            end tell
            close infoWindow1
            set infoWindow2 to open information window of item k of theFiles
            tell application "System Events"
                keystroke tab
                keystroke "v" using command down
            end tell
            close infoWindow2
        end tell
    end repeat
    tell application "Image Events" to quit
end tell
Message was edited by: Pierre L. (“count folder” instead of “count files of folder”)

Similar Messages

  • How to delete a jar file after loading image files from it

    Hi,
    How can I delete a jar file after some image files have been loaded? For example, say, I have "a.jar" which contains an image "a.gif" in the root directory of the c drive. I would like to get the image size and then delete the jar file. Here is the code snippet:
        URL url = new URL("jar:file:/C:\\a.jar!/a.gif");
        Icon icon = new ImageIcon(url);
        System.out.println("icon size ? " + icon.getIconHeight());
        File file = new File("c:\\a.jar");
        while(file.exists())
            file.delete();
            try
                Thread.sleep(100);
            catch (InterruptedException ignored)
        System.out.println("file deleted.");I get the image size correctly but just can not delete the jar file. Apparently the file handle is not released, but how to close it? Any hint will be appreciated.
    Justin Jan

    I am sure the URLConnection.defaultUseCaches is set before it is connected otherwise I should catch an IllegalStateException on conn.setUseCaches(false).
            try
                URL url = new URL("jar:file:/C:\\a.jar!/a.gif");           
             URLConnection conn = url.openConnection();
               conn.setDefaultUseCaches(false);
             conn.setUseCaches(false);
                Icon icon = new ImageIcon(url);
                System.out.println("icon size ? " + icon.getIconHeight());
                url.openConnection().getInputStream().close();
                System.gc();
             System.runFinalization();
                File file = new File("c:\\a.jar");
                while (file.exists())
                    file.delete();
                    try
                        Thread.sleep(10);
                    catch (InterruptedException ignored)
                System.out.println("file deleted.");
            catch (Throwable t)
                t.printStackTrace();

  • How do I remove "All My Files" icons from the toolbar?

    Good Afternoon:
    I have A shiny new 15" MBPro that came preinstalled with Lion that I have updated to 10.7.1.
    If I open a finder window, there are two "All My Files" icons on either side of the toolbar. I asked a Genius about it and they said they had never seen that. I can remove "All My Files" from the list of Favorites on the left easily enough. I can open up the window to customize the ToolBar, but in that window there are no "All My Files" icons available to add or delete.
    How do I remove the "All My Files" icons from the toolbar?
    Any advice would be appreciated. Thanks.
    Below is a screenshot of the problem.

    Sort of surprised they didn't know. I'm lost as to why that even appeared on your computer unless you had put them there yourself which, clearly, you didn't if it was brand new out of the box.
    Glad it's sorted out.

  • How to get folder(directory path only not file path) from local file system

    Hi Firends,
    How to get folder(directory path only not file path) from local file system , whenevr i will click on browse button.
    Please give reply for this one , if anybody knows.
    Thanks,
    Anderson.

    Hi Anderson,
    if you're using flash.filesystem.FileReference - then it is run in black box - except of filename, size and creation data (and few other properties available after some operation succeeded). This is part of security features in Flash runtime (described in header section):
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference .html
    This for example implies that user can download a content to local machine - but that content cannot be loaded back into Flash runtime. For this you would need either Air runtime flash.filesystem.File:
    http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/filesystem/File.h tml
    (so you would created Air runtime based application: desktop or mobile but not web, even as standalone project) or you would need one of 3rd party tools that add file access/file information features to standard Flash runtime applications converted to standalone native applications.
    hth,
    kind regards,
    Peter

  • How do you remove face tagging icon from images.  I cannot get them off some images.

    How do you remove face tagging icon from images.  I cannot get them off!  This is for adobe photoshop elements 6.   Thanks

    The links below have instructions for deleting photos.
    iOS and iPod: Syncing photos using iTunes
    http://support.apple.com/kb/HT4236
    iPad Tip: How to Delete Photos from Your iPad in the Photos App
    http://ipadacademy.com/2011/08/ipad-tip-how-to-delete-photos-from-your-ipad-in-t he-photos-app
    Another Way to Quickly Delete Photos from Your iPad (Mac Only)
    http://ipadacademy.com/2011/09/another-way-to-quickly-delete-photos-from-your-ip ad-mac-only
    How to Delete Photos from iPad
    http://www.wondershare.com/apple-idevice/how-to-delete-photos-from-ipad.html
    How to: Batch Delete Photos on the iPad
    http://www.lifeisaprayer.com/blog/2010/how-batch-delete-photos-ipad
    (With iOS 5.1, use 2 fingers)
    How to Delete Photos from iCloud’s Photo Stream
    http://www.cultofmac.com/124235/how-to-delete-photos-from-iclouds-photo-stream/
     Cheers, Tom

  • My goal: "convert into pdf" -- the file is instantly saved with the same name as pdf. feasible?

    Good evening dear experts,
    i use Adobe Acrobat 9 pro extend to convert word, ppt, jepgs etc. into pdfs.
    No if i
    1) convert a ppt into a pdf: it asks --> "save as" --> converts --> opens the file
    2) convert a jpeg into a pdf: it instantly --> opens the file as pdf --> i need to save it manual under "save as"
    In both cases i want to
    my goal: "convert into pdf" --> the file is instantly saved with the same name as pdf
    WITHOUT asking me "save as" + "opening of the file".
    Is the possible, and if yes, HOW ?
    A fast answer is very very much appreciated, for i have to convert hundreds of files tonight in order to get it into 1 pdf
    Thx and greetings from Germany,
    Julia

    We are nearly there!
    A] - righclick "convert-to-method": @Bill: thx again, your approach worked for ppt, doc-files etc.
    2 problems:
    1) exception: for jpegs/bmps it doesn't work (the file is still opened after conversion, strange).
    2) the output-folder. it only accepts the standard "output-folder documents/*.pdf" (which is a step further but not my end-goal). If i choose another output-folder via "browse", this setting is NOT SAVED (even after clicking on "accept" + "ok").
    my goal: the the file should be automatically saved in THE SAME folder the original file is in (seems that can't be achieved and the standard folder is the only thing where to convert in?).
    Personal background for understanding: i have many folders with several ppts in it. Once i send it out to a customer, i always have to convert it into a pdf. thats why i want to save time (i know that i can convert it directly + send per mail, but i want an up-to-date copy of the pdf in the folder as well).
    B] - "the automated solution"- @Sandeep:
    i just watched your link http://tv.adobe.com/watch/acrobat-tips-and-tricks/automating-tasks-in-acrobat/
    about batch processing and i think its really helpful if i want to convert ALL of the files in one folder.
    1 question regarding this: are the subfolders also affected?
    As i understood from the video, i choose 1 "watched folder" and a "destination folder" (can be the same). E.g i have 1 big folder "designs" with many subfolders. I create a batch converting ppts to pdf to "the same folder" Once i run my batch, it converts ppts in the chosen folder "designs" + all subfolders into the same folder, right?
    If this is the case, i get too many pdfs, for i only need the latest ppt-version to be converted (copies of old ppts are also in the files) ;(.
    Do you have an idea how can i solve this?
    Now we are very near to the end-solution of my goal:
    i need this option "to the same folder" in my general settings when i convert a file via right-click. ATM it only works with the standard-folder documents/*.pdf
    In A], my files are now instantly saved with the same name in 1 specific folder. I would be completely happy, if this folder would be alwys the same as the one with the original file (and not 1 specific folder)
    2nd problem with a]: it does not apply to picture files (bmp, jpegs..)
    So if we could solve this, i would be a completely happy girl
    Guys, you are great, thx again for the whole struggle with my concerns!!

  • Setting background from image file in NetBeans

    Hello,
    recently I started to use NetBeans to create my applications and I found a little problem - I don't know how to set background in JPanel from a image file (*.bmp, *.jpg, etc.) without writing my own code. I found how to use ImageIcon, but cannot deal with setting background. Anyone know a solution?

    The code that you have to write is a custom JPanel (extend it) and in the paintComponent() method you draw the image you want as a background.
    public void paintComponent(Graphics g)
    super.paintComponent(g);
    g.drawImage(img, 0, 0, null);
    }Where 'img' is an object of type Image (such as a BufferedImage).

  • IMPORTING: How do I set IP 09 to Copy image files into iPhoto09 on import?

    I have a number of image files stored in folders on my desktop.
    How do I set iPhoto 09 to copy the files from these folders on import and not just reference the image files in the spot they currently reside? After importing these files I would like to trash the folders on my desktop....

    iPhoto Menu -> Preferences -> Advanced tab
    Make sure the box at 'Copy Items to the iPhoto Library' is checked.
    Regards
    TD

  • Loading icons from jar file

    Hello,
    i am trying to load ALL imagefiles from my jar file. i do the following:
    Class clazz = Class.forName("com.xxx.IconSelectionDialog");
    String me = clazz.getName().replace(".", "/") + ".class";
    dirURL = clazz.getClassLoader().getResource(me);
    if (dirURL.getProtocol().equals("jar")) {
    String jarPath = dirURL.getPath().substring(6, dirURL.getPath().indexOf("!")); //strip out only the JAR file
    JarFile jar = new JarFile(jarPath );
    Enumeration<JarEntry> entries = jar.entries(); //gives ALL entries in jar
    while (entries.hasMoreElements()) {
    JarEntry nextEntry = entries.nextElement();
    String jarEntryName = nextEntry.getName();
    this works fine with my debug local jws installation. when i try to run it online starting i get an error:
    java.io.FileNotFoundException: xentis.jar (Das System kann die angegebene Datei nicht finden)
         at java.util.zip.ZipFile.open(Native Method)
         at java.util.zip.ZipFile.<init>(ZipFile.java:114)
         at java.util.jar.JarFile.<init>(JarFile.java:133)
         at java.util.jar.JarFile.<init>(JarFile.java:70)
    how can i load ALL icons from a jar (without knowing the filename) ?
    is there a generic way to iterate over all entries of a jarfile ?
    thank you
    michael

    Look at "Loading Images Using getResource" on this page
    http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html
    It should provide some ideas.

  • Unusual Bug when creating pdf from image files

    Hi I have a very mindboggling problem which I cant seem to get my head around.
    basically I am trying to create a pdf using a large amount of image files, these images are scans of pages of a book. so I have been trying to create a pdf file from these images, and everytime i try, it all looks ok except for one page which comes up smaller in size than the rest which is a big problem and very unusual. If I change the view of acrobat so that it shows two pages at a time then this is clearly visable where one page is normal and the page next to it is like a third of the size. Ive checked the image file properties for that page and they are more or less the same as the rest, the dimensions of the image file too, but when I add it into a PDF it seems to shrink in size, any ideas as to why? any help would be much appreciated! (and I hope what I said made sense lol )
    Thanks
    Nav

    Hi Davew000
    Can you please tell the steps you are doing to create the PDF ?
    Thanks,
    Tanvi

  • Pdftotext extracting from image files mystery

    hello all, just had a bit of a shock when I ran pdftotext (accidentally) on an unocr'd pdf file, and it extracted all the text. Running pdftohtml (as I'd intended) produced the expected output - i.e. png dumps. Curious, I then tried running it on a bunch of other downloaded files, and with the exception of one, pdftotext extracted the text from ALL of them. The mystery then is that it isnt using any ocr (no tesseract dependency, plus it's way too quick), so clearly it must be pulling it directly from the files. But if the text really is there in the original, then presumably the people who scanned them didn't know, else they'd have left it there. The only thing I can think is that some common piece of pdf software (probably acrobat) has ocr built in, so it's scanning them automatically and then encoding the hidden text in the pdf.
    take for example (legal):
    http://www.cd3wd.com/cd3wd_40/JF/JF_VE/SMALL/27-714.pdf
    open up in a normal pdfreader - very clearly a (poorly) scanned document. Now run 'pdftotext -layout'  on it and you get a pretty impressive text file, considering the source. Sure, some of the formatting is messed up, but I'm sure anyone with sed knowledge could quickly sort most of that out. Besides, that's one of the worst documents -  on most others it was perfect, maintaining columns (even tesseract can't do that) and everything.
    It makes for a fantastic command line pdf reader that works on almost all the files I've thrown at it, and since pdf's are almost the only reason I ever have to load up X, consider me tickled pink.
    Just thought I'd mention it here, as a google search brings up nothing on the issue. hope someone finds it useful

    Yes, Adobe Acrobat has a feature that allows you OCR the text and insert the text as a separate layer behind the image. Such PDFs are called "Searchable image PDFs". There are no doubt some other commercial software options that can do this too. The copier/scanner/multifunction device in my office actually does this automatically when you scan in a text PDF.
    Theoretically, it is even possible to create PDFs like this using free software on linux (a combination of ExactImage and Cuneiform; or WatchOCR).
    See, e.g., this blog post:
    Searchable PDFs with linux
    and this slashdot story:
    Open Source OCR that makes Searchable PDFs
    My own experiments with trying to get something like this to work have not been very successful--at least the quality of the result is nowhere near what I'm getting with our work printer.
    If you like pdftohtml, you should also know about pdfreflow, which takes the XML output of pdftohtml with the -xml flag and creates an html file that can be reflowed (I.e., is smart about paragraph breaks, removes page numbers and recombines words broken through hyphenation and so on).
    pdfreflow
    Last edited by frabjous (2010-10-15 13:03:00)

  • Reading metadata to - from image files

    I am using Creative Suite CS4.  In CS3 I created two custom XMP metadata pages that I used to add information to RAW, TIF, PSD files.  The resulting custom panel could be seen and used in Bridge and Extensis Portfolio.  In CS4 that all changed.  I can create the GUI part of the panel using Flex Builder 3.
    My questions are 1) How do you get the controls to work (combo boxes with fixed lists, fields for text data and a note field), 2) how do I get the data from the image file, have it update when a field changes, read it back to the image file when closed, and 3) how do I get it to work in Bridge CS4 properly and also be readable to Extensis Portfolio.
    I have attached the CS3 files that were used to create the panels in CS3.
    Fred

    I am using Creative Suite CS4.  In CS3 I created two custom XMP metadata pages that I used to add information to RAW, TIF, PSD files.  The resulting custom panel could be seen and used in Bridge and Extensis Portfolio.  In CS4 that all changed.  I can create the GUI part of the panel using Flex Builder 3.
    My questions are 1) How do you get the controls to work (combo boxes with fixed lists, fields for text data and a note field), 2) how do I get the data from the image file, have it update when a field changes, read it back to the image file when closed, and 3) how do I get it to work in Bridge CS4 properly and also be readable to Extensis Portfolio.
    I have attached the CS3 files that were used to create the panels in CS3.
    Fred

  • Batch extract file resolution from image xmp file

    Hi all,<br />I am looking for a batch process that extracts the X & Y pixel dimensions for a bunch of TIFF files.<br />I find the data in the XMP file when I save out the file:<br /><rdf:Description rdf:about=''<br />  xmlns:tiff='http://ns.adobe.com/tiff/1.0/'><br />  <tiff:XResolution>3000000/10000</tiff:XResolution><br />  <tiff:YResolution>3000000/10000</tiff:YResolution><br />  <tiff:ResolutionUnit>2</tiff:ResolutionUnit><br /> </rdf:Description><br /><br />I do not know if I need to start with the XMP file or if I can start with the source TIFF file.<br />Ultimately I would like to save the dimensions to a database.<br />Any help would be great

    It looks like every time I capture an image of a vm, a snapshot is taken of each disk and then a vhd object is also created. So can I convert the vhd's to a disk without going through the create-a-vm-from-image process? Going even further, if I just took
    snapshots of my vm's, can I turn those snapshots directly into disks?

  • Unable to create cd from Image file

    I downloaded the Solaris 8 for Intel, unzipped the files. I have been unsuccessful creating an image file for the file sol-8-1_01-fcs-bin-ia-v1. I have tried various CD writing applications.
    I was able to create images from the other files.
    Thanks

    You are not supposed to create an image file from the unzipped data. These unzipped files are image
    files! You just have to rename them using the proper file extension so that your CD-R burning software
    recognizes them as cd image files. (common extension are .ISO or .RAW; check with your CD recording
    software)

  • Video from image files

    How can I make a short video for watching in my iPod 30GB from some image files?
    Thank you

    ckaker_kid says:
    1. take a screen shot of every slide.
    2. either put the image files into the ipod separtely or make a short video with them
    I think from .png files
    Thank you

Maybe you are looking for