Re: Profile monitor for many users
Re: Profile monitor for many users
- Subject: Re: Profile monitor for many users
- From: Peter Miles <email@hidden>
- Date: Thu, 31 Mar 2011 13:01:45 +1300
Hi all,
The following Applescript may be of use to some, it allows automatic
setting of custom color profile(s).
Components:
• ColorSyncScripting app - from later versions of OSX10.5 onwards,
Apple replaced it with 'Image Events', which is supposedly more
'feature-rich'
but I haven't figured a way to replicate what the ColorSyncScripting
does! Without this app, the important bit of the script won't work.
Location for this used to be: /System/Library/ScriptingAdditions/.
• cscreen - If you use dual displays, you need the cscreen utility
(detects displays - probably could be done other ways, but we already
use cscreen for setting resolutions). I don't know who wrote cscreen,
but it is getting hard to find (http://hintsforums.macworld.com/
showthread.php?t=59575).
How it works:
Set a naming convention for your color profiles, then modify the find
string in the AppleScript accordingly (modify NAME HERE in the script).
The script then sets the chosen color profile to the display, or
alerts the user that no color profile was set, and provides a single
click to manually review the current color settings in the Displays
System Preference.
The cscreen utility then detects any secondary display and runs
through the same process, searching for a profile with '2nd' in the
name.
Change PATH/TO/CSCREEN to wherever cscreen is located.
Save as a run only Application and set as a login item. Remember that
any components used in the script will need read access for all users.
on run
## attempt to set icc profile for the main display ##
try
set iccFile to do shell script "find /Library/ColorSync/Profiles/
Displays/ -name 'NAME HERE'
set openFile to iccFile
--display dialog openFile
end try
try
set test to POSIX file openFile
set aliasFile to test as alias
--display dialog test
tell application "ColorSyncScripting.app"
--repeat with x from 1 to (count of display)
set «class mPrf» of «class disp» 1 to aliasFile
--end repeat
end tell
on error errmsg
activate
set question to display alert "The main display is not color
calibrated!" message "Color & tone displayed on this screen is
different to the color & tone encoded in your image files.
Click OK to see avalible Color Profiles" buttons {"dismiss", "OK"}
default button 2 giving up after [(50)] as warning
set answer to button returned of question
if answer is equal to "OK" then
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.displays"
get the name of every anchor of pane id
"com.apple.preference.displays"
--> returns: {"displaysArrangementTab", "displaysColorTab",
"displaysGeometryTab", "displaysDisplayTab"}
reveal anchor "displaysColorTab" of pane id
"com.apple.preference.displays"
end tell
end if
if answer is equal to "cancel" then
end if
end try
tell application "ColorSyncScripting.app" to set «class qdel» to 5
## use cscreen to find out how many displays we have ##
try
set displaynumber to do shell script "PATH/TO/CSCREEN -l | head -1"
set openFile to displaynumber
--display dialog openFile
if openFile is equal to "1 display found" then
## stop script, as we cannot set color profile for a non-existent
display! ##
return
end if
end try
## attempt to set icc profile for secondary display - name must
contain '2nd' ##
try
set iccFile to do shell script "find /Library/ColorSync/Profiles/
Displays/ -name '*2nd*' | sort -r | head -n 1"
set openFile to iccFile
--display dialog openFile
end try
try
set test to POSIX file openFile
set aliasFile to test as alias
--display dialog test
tell application "ColorSyncScripting.app"
--repeat with x from 1 to (count of display)
set «class mPrf» of «class disp» 2 to aliasFile
--end repeat
end tell
on error errmsg
activate
set question to display alert "The secondary display is not color
calibrated!" message "Color & tone displayed on this screen is
different to the color & tone encoded in your image files.
Click OK to see avalible Color Profiles" buttons {"dismiss", "OK"}
default button 2 giving up after [(50)] as warning
set answer to button returned of question
if answer is equal to "OK" then
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.displays"
get the name of every anchor of pane id
"com.apple.preference.displays"
--> returns: {"displaysArrangementTab", "displaysColorTab",
"displaysGeometryTab", "displaysDisplayTab"}
reveal anchor "displaysColorTab" of pane id
"com.apple.preference.displays"
end tell
end if
if answer is equal to "cancel" then
end if
end try
tell application "ColorSyncScripting.app" to set «class qdel» to 5
end run
If anyone finds this useful, or has other ideas for it, I'd be keen
to hear from you.
Cheers,
Hamish
--
Hamish Ward
Mac Software Image Development
Information Technology Services
Massey University
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Colorsync-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden