capturing the activation request for ColorEyes Display Pro (CED Pro)

Supporting Macs goes hand in hand with supporting graphic design software, fonts, printers, office productivity software, and color calibration software. ColorEyes Display Pro (CED Pro) is one of these color-calibration softwares. In order to license it, a Mac must be connected to the internet and able to communicate with a licensing server that you have no access to or control over.

When ColorEyes licenses itself  on first launch (and verifies this license every subsequent launch thereafter), it sends an “Activation Request Number” to the licensing server. This request number is apparently generated on the fly and not stored in a plist or other easily-accessible form. This activation is also only valid for three non-unique activations (i.e.: a dual boot machine would require 2 of these 3, or reimaging a machine without releasing the 1st activation would eat up a 2nd activation). This is not a new concept to Mac admins since software like Quark has acted this way for years. What IS a new concept, however, is the fact that the CED Pro licensing server keeps no record of what machine is tied to what activation code, so the ONLY way to gather this information is to manually launch the software while holding command+shift, choose “Show Field Data” from the drop-down menu that appears, and copy the request number.

Why should this matter, you ask? Well, if you are out of activations on one or more Macs, it seems like the software starts eating up unused activations until you have none left, even though you may have plenty of seats left for licensing considerations – in short you won’t be activating any more color eyes installations until you sort this out, by providing a list of all legitimate activations to the company so they can clean out the phantom activations from their server. For an enterprise, this simply will not work well, so I developed an automated way of getting this info through a combination of bash and applescript.

As I mentioned before, CED Pro does not keep this information inside the plists it creates, so I could not write a script to simply read those files and gather the information I needed. Therefore I wrote a GUI script with bash and applescript to simulate a user launching CED Pro with the command+shift key combo, selecting the correct menu item, and copy/pasting the request number field information. What follows is the fruit of my labor, all scripted up and ready to be dropped into JAMF as an extension attribute. As always, feel free to use my code as long as you keep the header intact, and I am not responsible for what you do or do not do with this code:

#!/bin/sh
########################################################### START HEADER ############################################################
## Use this code freely as long as you keep this header intact
## GetCEDPRequestNumber.sh written by Andrew Caldwell, 7/2012
## Although this code is tested and functional on 10.5 and 10.6, your mileage may vary and I accept NO responsibility for you
## using this code on your own Mac(s)
########################################################### END HEADER ############################################################
## First check to see if a user is logged in. If no user is logged in, the osascript will fail.
loggedInUser=`who | grep console`
if [ "$loggedInUser" == "" ]; then
 echo "No user is logged in."
 exit 0
fi
## Check to see if ColorEyes is running. If so kill it, since the script will epicly fail otherwise.
CEDPro=$(ps -ax | grep -i "ColorEyes Display Pro.app/Contents/MacOS/ColorEyes Display Pro" | grep -vi "grep" | awk ' { print $1 } ')
if [ -n "$CEDPro" ]; then
 kill -s KILL "$CEDPro" > /dev/null 2>&1
 sleep 2
fi
## Only run this script if the computer has CEDPro on it
if [ -e "/Applications/ColorEyes Display Pro/ColorEyes Display Pro.app" ]; then
## In order to pass variables from osascript you need to set a variable in bash = to the result of the osascript
Req=$(/usr/bin/osascript <<endCERequest
tell application "System Events"
 key down command
 key down shift
 do shell script "open '/Applications/ColorEyes Display Pro/ColorEyes Display Pro.app'"
 delay 10
 key up command
 key up shift
 tell process "QuickLicenseRT"
 delay 3
 click pop up button 1 of window "License Options" -- access the menu to select show field data
 key code 125 -- down arrow
 key code 125 -- down arrow
 keystroke return -- press return when we get to "Show Field Data"
 delay 2
 keystroke tab -- tab to access the text data (request number)
 key code 125 -- down arrow twice to get to the request number
 key code 125
 delay 2
 key down command
 keystroke "c" -- copy it to the clip board
 key up command
 delay 2
 keystroke return -- close the License Options window
 delay 2
 keystroke return -- if the user has a setting out of place in their sys prefs, CEDP will alert them to this. Close this window.
 set RequestNumber to the clipboard -- in order to throw the data into a variable
 return RequestNumber
 end tell
end tell
endCERequest
)
## Ensure that what was returned was an integer. If not, the user might have interfered with the GUI script. We don't want to write down whatever randomness might have been generated
Req=`echo $Req | awk '{print $3}'`
if [ $Req -eq $Req ]; then -- quick and easy test to ensure an integer 
 echo "<result>$Req</result>"
fi

killall ColorEyes\ Display\ Pro
else
 echo "<result>NA</result>"
 exit 0
fi

There is one caveat: This IS a GUI script, so will affect the user experience when it runs. ColorEyes will launch, and any interference with the Mac while this script is running (mouse clicks, tabs, arrow keys, typing, anything) can cause the script to fail or spit our garbage data. Download a copy of it here: https://dl.dropbox.com/u/5413877/GetCEDPRequestNumber.sh


About this entry