/* AmigaTemp ARexx V1.4 9612020 */
/* Lists names, temperatures max/min temperatures and dates for all connected sensors */
/* Start */
if(Show(P, "AmigaTempMessPort") == 0) then /* Is AmigaTemp running? */
do /* No... */
Address COMMAND
'run >NIL: <NIL: AmigaTemp:AmigaTemp' /* Start AmigaTemp. */
'waitforport AmigaTempMessPort' /* Wait until program has started or at least 10 sek */
if ~Show(P, 'AmigaTempMessPort') then do /* Something is wrong... */
Say "No contact with AmigaTempMessPort"
exit
end
address COMMAND wait 3 /* Wait until AmigaTemp has init itself */
end
if(Show(P, 'AmigaTemp') == 0) then /* Is AmigaTemp ARexx running? */
do /* No... */
Address COMMAND
'run AmigaTemp:AT_ARexx' /* Start AmigaTemp ARexx. */
'waitforport AmigaTemp' /* Wait until program has started or at least 10 sek */
if ~Show(P, 'AmigaTemp') then do /* Something is wrong... */
Say "No contact with ARexx Port"
exit
end
end
/* Main */
Options RESULTS /* Retrive the string result field */
Address 'AmigaTemp' /* Portname for AmigaTemp (Case sensitive) */
'Version'; Say result /* Write version */
'Lock'
'NumSensor'; numsensor = result /* Number Of Sensors */
Say 'Name Temp Tend Max/Min Date'
Say '---------------------------------------------------------------------------'
do i=1 to numsensor
'Name' i /* Name of sensor */
If rc == 0 then /* rc == 0 if sensor is connected */
do
name = left(result, 18) /* Name of sensor */
'Tendency' i; tend = result /* Temperature tendency (+,-,' ') */
/* Add these lines if you always wants correct act/max/min temperatures */
/*
If tend == '?' then do
'cache'; oldcache = result; 'cache' 0
do while tend == '?'
address COMMAND wait 1
'Tendency' i; tend = result
end
'cache' oldcache
end
*/
'Temp' i; /* Current temperature */
temp = right(result, 10)
'Type' i; type = result /* Sensor type (░C/░F/...) */
'Max' i; /* Max temperature */
max= right(result, 10)
'DateMax' i; maxdate = result /* Date for max temperature */
'Min' i; /* Min temperature */
min = right(result, 10)
'DateMin' i; mindate = result /* Date for min temperature */
Say name || temp || ' ' || type ' ' || tend || ' ' || max || ' ' || type || ' ' || maxdate
Say ' ' || min || ' ' || type || ' ' || mindate;
Say '---------------------------------------------------------------------------'
end
If rc > 1 then /* No error msg if rc == 1 (Not connected) */
do
'Translate' rc /* Translate rc to text error msg */
Say "Error: " || result
'UnLock'
exit
end
end i
'UnLock'