REM > AutoFinger HOST$ = "mail.example.com" :REM name of computer to finger USER$ = "james" :REM user name there POLLTIME% = 60 * 100 :REM interval, centiseconds REM-------------------------------------------------------------------------------- ON ERROR ON ERROR OFF: ERROR 0, "AutoFinger: " + REPORT$ + " (" + STR$ERL + ")": END DIM b% 1000, ind% 255 SYS"Wimp_Initialise", 310, &4b534154, "AutoFinger", 0 TO , task% PROCwindow PROCfinger REPEAT SYS"OS_ReadMonotonicTime" TO time% SYS"Wimp_PollIdle", &1c30, b%, time% + POLLTIME% TO reason% CASE reason% OF WHEN 0, 6: PROCfinger WHEN 2: b%!28 = -2: SYS"Wimp_OpenWindow",, b% WHEN 3: SYS"Wimp_CloseWindow",, b% ENDCASE UNTIL (reason% = 17 OR reason% = 18) AND b%!16 = 0 SYS"Wimp_CloseDown", task%, &4b534154 END REM-------------------------------------------------------------------------------- DEF PROCwindow b%!00 = 0: b%!04 = 134: b%!08 = 2000: b%!12 = 178 b%!16 = 0: b%!20 = 0 b%!24 = -2 b%!28 = &80000812 b%?32 = 7: b%?33 = 2: b%?34 = 7: b%?35 = 1 b%!40 = 0: b%!44 = -44: b%!48 = 2000: b%!52 = 0 b%!56 = &0 b%!60 = &3000 b%!64 = 1 b%!68 = 0 b%!84 = 1 b%!88 = 0: b%!92 = -44: b%!96 = 2000: b%!100 = 0 b%!104 = &1b003111 b%!108 = ind% b%!112 = 0 b%!116 = 200 SYS"Wimp_CreateWindow",, b% TO window% ENDPROC REM-------------------------------------------------------------------------------- DEF PROCclose !b% = window% SYS"Wimp_CloseWindow",, b% ENDPROC REM-------------------------------------------------------------------------------- DEF PROCshow LOCAL width% b%!00 = window% b%!04 = 0 b%!08 = 0 b%!12 = 0 SYS"Wimp_SetIconState",, b% SYS"Wimp_TextOp", 1, ind% TO width% SYS"Wimp_GetWindowState",, b% b%!12 = width% + 20 b%!28 = -2 SYS"Wimp_OpenWindow",, b% ENDPROC REM-------------------------------------------------------------------------------- DEF PROCfinger LOCAL esocket%, state%, read%, closed%, len% SYS"ESocket_ConnectToHost", HOST$, 79 TO esocket% REPEAT SYS"ESocket_CheckState", esocket% TO state% UNTIL state% = 4 OR state% < 0 IF state% < 0 THEN SYS"ESocket_DecodeState", state% TO $ind% PROCshow ELSE SYS"ESocket_SendLine", esocket%, USER$, 0 REPEAT SYS"ESocket_ReadLine", esocket%, ind%, 256, %100 TO , read%, len% SYS"ESocket_Closed", esocket%, 1 TO closed% SYS"Wimp_Poll", &e1ffc, b% UNTIL read% OR closed% IF read% AND len% > 2 THEN PROCshow ELSE PROCclose ENDIF ENDIF SYS"ESocket_Forget", esocket% ENDPROC