HELP with Automator Scripts

Discussion in 'Mac Programming' started by Toby Goodbar, May 22, 2010.

  1. Toby Goodbar macrumors 6502

    Joined:
    Sep 8, 2006
    #1
    i've used automator before to do some simple things like batch file renaming, but admittedly with some difficulty and need some help now that i want to try something a little more complex.

    WHAT:
    i want to make a script that will select each file in a certain folder and copy the icon from the "get info" pane and paste it back

    WHY:
    now i know this sounds redundant but the reason is because i have a media folder where ive stored ripped movies and music and for each one i had googled the image to album or dvd covers and pasted them in. At some point after my conversion to leopard 10.5.x, i discovered these icons will NOT show in coverflow. only the ones i pasted in while operating on tiger 10.4.x. what i noticed however, is that with the release of snow leopard 10.6 which operates on my intel macbook, any icons pasted in using the 10.6 os will showup in coverflow now on leopard 10.5. my media hard drive stays attached to the ppc desktop so upgrading to snow leopard 10.6 is impossible and this is the desktop that is hooked up to the big monitors and tv so i woud really like to browse the media folder with coverflow.




    ANY help or guidance would be much appreciated since i still stubmble through automator each and every time i try to create a script.
     
  2. numero macrumors regular

    Joined:
    Jul 23, 2002
    Location:
    OR
    #2
    Not in Automator. Just a straight AppleScript. Change the path to the folder you want to act on.

    Code:
    tell application "Finder"
    	activate
    	set baseFolder to folder "temp" of desktop
    	open baseFolder
    	set theFiles to every file in baseFolder
    	repeat with aFile in theFiles
    		select aFile
    		tell application "System Events"
    			keystroke "i" using command down
    			keystroke tab
    			keystroke "c" using command down
    			keystroke "v" using command down
    			keystroke "w" using command down
    		end tell
    	end repeat
    end tell
    -numero
     
  3. Toby Goodbar thread starter macrumors 6502

    Joined:
    Sep 8, 2006
    #3
    is the "temp" folder in the script the folder for which i am talking about? and i need to insert the name?

    basically i am trying to determine how the finder will 'know' which files it is working with.

    thank you, i appreciate the help
     
  4. numero macrumors regular

    Joined:
    Jul 23, 2002
    Location:
    OR
    #4
    Yes.
    Code:
    set baseFolder to folder "temp" of desktop
    will set a reference to the folder containing the files you want to edit. I am calling this reference "baseFolder".

    If the folder you want use is on the desktop then just change "temp" to whatever your folder's name is.

    If the folder is in a different location and you don't want to put it on the desktop then do something like this:
    Code:
    set baseFolder to folder "Documents" of folder "numero" of folder "Users" of disk "Macintosh HD"
    --numero
     

Share This Page