Hej! Jag är en retuschör & webbutvecklare i Stockholm. Jobbar på Mirage Imaging i Gamla stan och gillar wordpress, kreativ retusch och roliga djur.

Max Berggren

maxberggren@gmail.com

+46 (0)736 49 38 50

Colour in Finder if Clipping Path found

3 år, 3 månader sedan

Here’s an AppleScript I made that checks images files for clipping paths and then labels the files with colour in Finder. Works with drag & drop. Click here to download.

on run
	display dialog "Drop files onto this file to process them"
end run
 
-- DETERNIME IF ITS A FOLDER DROPPED AND FORWARD TO THE FUNCTION process_item
 
on open these_items
	repeat with i from 1 to the count of these_items
		set this_item to (item i of these_items)
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			process_item(this_item)
		end if
	end repeat
end open
 
on process_folder(this_folder)
	set these_items to list folder this_folder without invisibles
	repeat with i from 1 to the count of these_items
		set this_item to alias ((this_folder as text) & (item i of these_items))
		set the item_info to info for this_item
		if folder of the item_info is true then
			process_folder(this_item)
		else if (alias of the item_info is false) then
			process_item(this_item)
		end if
	end repeat
end process_folder
 
-- ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
on process_item(this_item)
 
	tell application "Adobe Photoshop CS3"
		activate
 
		open this_item showing dialogs never
 
		tell current document
 
			-- CHECK FOR PATHS
			set CountOfPaths to every path item
			if CountOfPaths is equal to {} then
 
				-- IF THERE'S NO PATH
				tell application "Finder"
 
					-- MAKE RED IN FINDER
					set the label index of this_item to 2
 
				end tell
 
			else
 
				-- IF THERE IS A _CLIPPING PATH_
				if exists (every path item whose kind is clipping) then
 
					tell application "Finder"
 
						-- MAKE GREEN IN FINDER
						set the label index of this_item to 6
 
					end tell
 
				else
 
					-- IF THERE IS A PATH BUT _NO_ CLIPPING PATH
 
					tell application "Finder"
 
						-- MAKE PURPLE IN FINDER
						set the label index of this_item to 5
 
					end tell
 
				end if
 
			end if
 
		end tell
 
		-- CLOSE THE FILE
		close current document saving no
 
	end tell
 
end process_item

Kommentarer

  1. Joakim Alexandersson:

    Hej Max

    Har till min glädje tagit hem ditt “colourinfinderifclippingpathfound”-script och försökt få det att funka men jag får upp följande dialogruta “filen vissa objekt hittades inte”. Jag har testat med både filen från dig och droplet-versionen av den. Har du någon aning om vad det kan vara för fel?

    Vänliga hälsningar Joakim Alexandersson

Skriv