I thought I could share how I gather information about the host that is running the Indigo server, since I could not find any previous examples in the Indigo forums.
Disclaimer: I am not a software engineer, so my code WILL LOOK UGLY. If You don´t like it please feel free to improve!
My situation is that the computer is located in a closet where the temperature may exceed the operating limit of the MacBookPro currently running the software.
Thus I thought it would be wise to monitor the CPU temperature.
To gather the sensor values from a unix prompt the choice fell upon a small utility called "Temperature Monitor" found at http://www.bresink.com/osx/TemperatureMonitor.html.
(This was the only software I found that can be used from command-line.)
From this I created a small AppleScript to collect the data and get it into Indigo. ( I have enclosed it in this post).
I´m interested to learn if others have had similar problems and if so how You solved it.
Best regards
Anders K.
- Code: Select all
property return_f : false
try
set the_result to (do shell script "/Applications/TemperatureMonitor.app/Contents/MacOS/tempmonitor -tv")
on error
return "unknown"
end try
set alla_display to ""
# set thesensor to items 1 thru ((count of characters of the_result) - 5) of the_result
set thetemp1 to items 29 thru 30 of the_result
set thetemp2 to items 32 thru 33 of the_result
set thetemp1U to thetemp1 as Unicode text
set thetemp2U to thetemp2 as Unicode text
tell application "IndigoServer"
-- This checks to see if a variable named "MyVar" exists, and creates it if it doesn't
if not (variable "CPUtemp1" exists) then
make new variable with properties {name:"CPUtemp1", value:"Value"}
end if
-- This line sets it
set (value of variable "CPUtemp1") to thetemp1U
if not (variable "CPUtemp2" exists) then
make new variable with properties {name:"CPUtemp2", value:"Value"}
end if
-- This line sets it
set (value of variable "CPUtemp2") to thetemp2U
end tell