home *** CD-ROM | disk | FTP | other *** search
- AddExtender ("wwwsk32i.dll")
- IntControl (35, 500, 0, 0, 0)
- bOK = @TRUE
- sDial = "<dialupname>"
- nMaxRedial = <numredials>
- nRedialDelay = 10
- sPgmPath = "<pgmpath>"
- sPgmDir = "<pgmdir>"
- bSendMail = <sendmail>
- bEmpty = <empty>
- sErrDesc = ""
- nTimeout = 30 ; How many seconds of inactivity to wait
-
-
- ;**********************************************************************
- ;Dial our host (unless user is on a direct connect)...
- ;**********************************************************************
- hConn = 0
- nNumRedials = 0
- if (sDial <> "")
- :DialIt
- hConn = DUNConnect (sDial)
- nErr = SGetLastErr ()
- sErr = wxGetErrDesc (nErr)
- if (nErr == 633 && WinVersion(@MAJOR)==4 && WinVersion(@MINOR)==0)
- ; Error 633 under NT 4.0 >really< just means we're already connected...
- nErr = @SAlready
- hConn = 0
- else
- if (nErr!=@SAlready && !hConn)
- switch nErr
- case @SErrBusy
- case @SErrNoAnswer
- case 680 ; no dialtone
- if (nNumRedials <= nMaxRedial)
- nNumRedials = nNumRedials + 1
- Delay (nRedialDelay)
- goto DialIt
- endif
- break
-
- case @SErrNotFound
- case @SErrVoice
- case nErr ; <--default
- sErrDesc = "Couldn't connect to %sDial%: %sErr%"
- bOK = @FALSE
- goto LogIt
- endswitch
- else
- if (nErr == @SAlready)
- ; We're already connected. Don't hang up when this event is thru...
- hConn = 0
- endif
- endif
- endif
- endif
-
-
- ; Run Netscape & make it do things...
- sTitle = "Netscape"
- if (WinExist (sTitle))
- WinActivate (sTitle)
- else
- DirChange (sPgmDir)
- Run (sPgmPath, "")
- delay (2)
- endif
-
-
- ; Bring up the Mail window (which automatically gets new mail too)...
- SendKeysTo (sTitle, "!wm")
- Delay (10)
-
-
- if (WinExistChild(sTitle, "No new messages"))
- SendKey ("~")
- endif
-
- if (WinExist("Password Entry Dialog"))
- WinClose ("Password Entry Dialog")
- endif
-
-
- ; Send outgoing mail/articles (if chosen)...
- if (bSendMail)
- if (WinExist (sTitle))
- SendKeysTo (sTitle, "!fd")
- endif
- endif
-
-
- ; Wait for timeout on modem...
- nBytesMoved = wxGetInfo(3,hConn) + wxGetInfo(4,hConn)
- if (nBytesMoved != -1)
- nTimer = 0
- while (nTimer < nTimeout && WinExist(sTitle))
- Delay (1)
- nBytesPrev = nBytesMoved
- nBytesMoved = wxGetInfo(3,hConn) + wxGetInfo(4,hConn)
- if (nBytesMoved != nBytesPrev)
- ; Still data being moved in this period. Reset timer...
- nTimer = 0
- endif
- nTimer = nTimer + 1
- endwhile
- endif
-
-
- ; If user hit Ctrl+Break, WIL will bring us here...
- :Cancel
-
- ; Hang up if we're on a dial-up connection...
- :HangUp
- if (hConn)
- nRet = DUNDisconnect (hConn)
- endif
-
-
- ; Empty the trash (if chosen)...
- if (bEmpty)
- if (WinExist (sTitle))
- SendKeysTo (sTitle, "!fe")
- endif
- endif
-
-
- ; Log what we did...
- :LogIt
- if bOK == @TRUE
- sLog = "Ran Netscape"
- else
- sLog = strcat ("Error attempting to automate Netscape:", @CRLF, sErrDesc)
- endif
-
- CMLogMessage (sLog)
- Display (8, "ClockMan95", sLog)
- exit
-
- ~
-