home *** CD-ROM | disk | FTP | other *** search
- /* AmigaTemp V1.2 ARexx */
- /* Waits on ARexx temperature alarm. Break with Control+C */
-
- call addlib('rexxsupport.library',0,-30,0) /* Needed by Delay */
-
- /* Start */
- st = Show(P, 'AmigaTemp') /* Is program running? */
- if st == 0 then /* No... */
- do
- Address COMMAND
-
- 'AmigaTemp CX_POPUP=NO' /* Start AmigaTemp. Don't POPUP */
- if rc > 0 then do /* Program not found... */
- Say "Can't start AmigaTemp"
- exit
- end
-
- do 2 while ~Show(P, 'AmigaTemp') /* Wait until program has started or at least 20 sek */
- 'waitforport AmigaTemp'
- end
-
- 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
- Say 'Break with Control+C'
-
- 'NumSensor'; numsensor = result /* Number Of Sensors */
-
- do until 1 = 0 /* Loop for ever */
-
- do i=1 to numsensor
- 'Alarm' i /* Check alarm */
- If rc == 0 then /* rc == 0 if sensor is connected */
- do
- If result == 'Max' then /* Current temperature > max temperature */
- do
- 'Name' i; name = result /* Name of sensor */
- 'Temp' i; temp = result /* Current temperature */
- 'AlarmMax' i; max = result /* Max temperature */
- 'AlarmTextMax' i; textmax = result /* Text for max temperature */
-
- Say name || ':' || ' Max : ' || max || ' Current : ' || temp || ' ' || textmax
- end
- If result == 'Min' then /* Current temperature < min temperature */
- do
- 'Name' i; name = result /* Name of sensor */
- 'Temp' i; temp = result /* Current temperature */
- 'AlarmMin' i; min = result /* Max temperature */
- 'AlarmTextMin' i; textmin = result /* Text for max temperature */
-
- Say name || ':' || ' Min : ' || min || ' Current : ' || temp || ' ' || textmin
- end
- end
- end i
-
- call Delay(3*50) /* Wait 3 sec */
- end
-
- if st == 0 then 'Quit' /* Quit AmigaTemp if we started it */
-