Applescript moving files issue

Discussion in 'Mac Programming' started by Liquid80, Oct 2, 2013.

  1. Liquid80 macrumors newbie

    Joined:
    Oct 1, 2013
    #1
    Hello everyone, first time posting and first time getting into applescript. I've been trying to get the following script to work but it doesn't do anything. No errors or nothing! It's probably completely backwards and missing half of what I need but here it is:rolleyes:

    Code:
    on adding folder items to this_folder after receiving added_items
    	repeat with each_item in added_items
    		tell application "Image Events"
    			launch
    			copy the dimensions of added_items to {xdim, ydim}
    			if xdim is greater than 1270 then
    				duplicate each_item to folder "Users:xxxxxxx:Library:Application Support:Plex:userdata:Thumbnails:Video:Fanart"
    			end if
    			
    		end tell
    		
    	end repeat
    	
    end adding folder items to
    As you can probably tell I'm trying to move image files larger than 1270 wide to another folder once it is added. Any help is greatly appreciated
     
  2. kryten2, Oct 2, 2013
    Last edited: Oct 2, 2013

    kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Try this :

    Code:
    on adding folder items to this_folder after receiving added_items
    	repeat with each_item in added_items
    		try
    			tell application "Image Events"
    				-- start the Image Events application
    				launch
    				-- open the image file
    				set this_image to open each_item
    				--copy the dimensions of this_image to {xdim, ydim}
    				copy the dimensions of this_image to {xdim, ydim}
    				if xdim is greater than 1270 then
    					tell application "Finder" to duplicate each_item to (path to application support from user domain as text) & "Plex:userdata:Thumbnails:Video:Fanart"
    				end if
    				-- purge the open image data
    				close this_image
    			end tell
    		on error error_message
    			display dialog error_message
    		end try
    	end repeat
    end adding folder items to
    Info : http://macosxautomation.com/applescript/imageevents/index.html
     
  3. Liquid80 thread starter macrumors newbie

    Joined:
    Oct 1, 2013

Share This Page