Hi everyone,
Running into a slight snag here collecting some information from an application as an extension attribute.
This is the script I am using to populate the EA:
#!/bin/sh
## 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 5
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 -- throw the data into a variable
return RequestNumber
end tell
end tell
endCERequest
)
if [ $Req -eq $Req ]; then ## Check to make sure $Req returned a numeric value. -eq only evaluates numbers, so will fail if it's a non numeric
echo "<result>$Req</result>"
fi
killall ColorEyes Display Pro
else
echo "<result>NA</result>"
exit 0
fi
As you can see it's running an osascript since this crappy app requires gui scripting in order to get the info I need. The problem I'm running into is the EA never gets populated. If I run the script out of terminal or Casper Remote, it outputs correctly.
Anything obvious that my fuzzy brain has missed?