Color profiles on snow leo

Hi, my script does’t work, and i don’t know, why. (i prefer “Image events”, if possible)

tell application "Finder" to set the_pict to the selection
set profilePath to quoted form of POSIX path of ((path to library folder from system domain) & "ColorSync:Profiles:sRGB Profile.icc" as text)

set pathToImageFile to quoted form of POSIX path of (the_pict as text)
set cmdLine to ("sips -E profile " & profilePath & space & pathToImageFile) as text
do shell script cmdLine

(*
tell application "Image Events"
		set openedFile to open the_pict
		embed openedFile with source profilePath
		save openedFile 
		close openedFile
	end tell
*)

Hi,

selection of Finder contains a list of Finder file specifiers or an empty list if nothing is selected.
Either you process all items with a repeat loop or you must specify an item of the list.
This is the repeat loop solution


tell application "Finder" to set the_selection to the selection
set profilePath to quoted form of (POSIX path of (path to library folder from system domain) & "ColorSync:Profiles:sRGB Profile.icc")

repeat with the_pict in the_selection
	set pathToImageFile to quoted form of POSIX path of (the_pict as text)
	set cmdLine to ("sips -E profile " & profilePath & space & pathToImageFile)
	do shell script cmdLine
end repeat


Hi Stefan
i use ‘selection’ without specification, for convenience. Mostly i define it in a second moment, but here goes ‘as alias’ or ‘first item of (get the selection)’; nevertheless I get no results- (if i define selection or not) and the file rests without profile. The shell syntax is correct, not?
i’m on snow leo 4

unfortunately, the ‘tell “Image Events”’ routine is broken, or i’m wrong?

sorry , in my script the colons must be replaced by slashes, and profile is a placeholder, not a parameter.
Try this


tell application "Finder" to set the_selection to the selection
set profilePath to quoted form of (POSIX path of (path to library folder from system domain) & "ColorSync/Profiles/sRGB Profile.icc")

repeat with the_pict in the_selection
	set pathToImageFile to quoted form of POSIX path of (the_pict as text)
	set cmdLine to ("sips -E " & profilePath & space & pathToImageFile)
	do shell script cmdLine
end repeat


Many thanks, Stefan.
i got it! :cool:

curious that in profilePath we have to set slashes two times; because posix path should be enough to transmute a path in colons…

The difference is


set profilePath to quoted form of POSIX path of ((path to library folder from system domain) & "ColorSync:Profiles:sRGB Profile.icc" as text)

the alias (path to library folder) and the literal string “ColorSync:.” will be coerced to text (HFS path) and then coerced to POSIX path

set profilePath to quoted form of (POSIX path of (path to library folder from system domain) & "ColorSync/Profiles/sRGB Profile.icc")

the alias (path to library folder) will be coerced to POSIX path and the literal string “ColorSync:.” will be appended