Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Liquid80

macrumors newbie
Original poster
Oct 1, 2013
3
0
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
 
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
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.