/*-------------------------------------------------------------------------------------- START4ME.CMD Starten opgegeven programma's zodra er verbinding is Start programs that need a running connection RxSock.DLL is nodig voor dit script is required for this script version 6 feb 1996 Ron van Wier (ronvwier@xs4all.nl) http://www.xs4all.nl/~ronvwier/ -------------------------------------------------------------------------------------- */ call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs' call SysLoadFuncs call RxFuncAdd "SockLoadFuncs","RxSock","SockLoadFuncs" call SockLoadFuncs crlf = d2c(13) || d2c(10) /* Get info from INI */ ini = value('ETC',,'OS2ENVIRONMENT') || '\TCPOS2.INI' provid = sysini(ini,'CONNECTION','CURRENT_CONNECTION') POP3_Server = 'mail.xs4all.nl' POP3_Logonid = strip(sysini(ini,provid,'LOGIN_ID'),,x2c('00')) POP3_password = strip(sysini(ini,provid,'PWD'),,x2c('00')) call wait_for_connection /* --------------------------------------------------------------------------------------- Er is nu een werkende verbinding met het Internet At this point there is a working connection Plaats hieronder uw eigen START commando's Put your own start commands after this --------------------------------------------------------------------------------------- */ /* CHANGI newsserver exchange */ '@cd c:\changi' '@start /C /WIN C:\CHANGI\XCHANGE' /* How many mails are there for me? */ If Pop3Mail() > 0 Then Call Start_Ultimail_InBox exit /* --------------------------------------------------------------------------------------- Algemeen bruikbare functies: Usefull functions: Wait_For_Connection wacht totdat de verbinding bruikbaar is wait until there is a full functioning connection Start_Ultimail_InBox start ultimail op en toont de inbox start ultimail and open the inbox POP3Mail geeft aantal berichten in mailbox bij provider returns number of messages in mailbox on provider --------------------------------------------------------------------------------------- */ Wait_For_Connection: /* Is the name server reachable/working? */ say 'Waiting max. 30 sec. on full functioning connection' '@host xs4all.nl >nul' poging = 1 do while rc <> 0 & poging < 10 call charout ,'.' call syssleep 3 '@host xs4all.nl >nul' poging = poging + 1 end if rc = 0 then say ' connection OK' else do say ' connection is not functioning, ERROR' exit 1 end return start_ultimail_inbox: Call SysOpenObject '','DEFAULT',1 return Pop3Mail: /* get address of server */ rc = SockGetHostByName(POP3_Server,"host.!") if rc = 0 then return 0 /* open socket */ server = host.!addr sock = SockSocket("AF_INET","SOCK_STREAM",0) if (sock = -1) then return 0 /* connect */ server.!family = "AF_INET" server.!port = 110 server.!addr = server rc = SockConnect(sock,"server.!") if (rc = -1) then return 0 rc = SockRecv(sock,"data",8000) /* login */ call SockSend sock,"USER " || POP3_Logonid || crlf rc = SockRecv(sock,"data",8000) if (rc = -1) then return 0 call SockSend sock,"PASS " || POP3_Password || crlf rc = SockRecv(sock,"data",8000) if (rc = -1) then return 0 call SockSend sock,"STAT"crlf rc = SockRecv(sock,"data",8000) if (rc = -1) then return 0 parse var data ok nrmsgs octets call SockSend sock,"QUIT"crlf rc = SockRecv(sock,"data",8000) if (rc = -1) then return 0 call SockSoClose sock Return NrMsgs