;
; $VER: ygm.scr 1.0 (12.3.99)
;
; AmigaDOS script showing how to retrieve
; primary and secondary results from YGM
;

failat 21

YGM USER=<username> PASS=<password> SERVER=<popserver> NOREQ

set rcd `EVAL $result2 LFORMAT=%X8`+$rc
set rc1 `ECHO $rcd FIRST=10`
set rc2 `ECHO $rcd FIRST=0 LEN=8`
set rc2 `EVAL 0x$rc2*1`

if $rc1 EQ 0
	echo "Sorry, no new mail present"
else
	if $rc1 EQ 1
		if NOT `EVAL $rc2 & 0x01` EQ 0 VAL
			echo "You've got mail in mailbox #1"
		endif
		if NOT `EVAL $rc2 & 0x02` EQ 0 VAL
			echo "You've got mail in mailbox #2"
		endif
		if NOT `EVAL $rc2 & 0x04` EQ 0 VAL
			echo "You've got mail in mailbox #3"
		endif
	else
		echo "There were errors."RC:$rc1, RESULT2:$rc2
	endif
endif
