home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1997 November / PCO1197.ISO / FilesBBS / WIN95 / CM95-10.EXE / INTERNET.DLL / TEXT / WILNETSCAPE < prev    next >
Encoding:
Text File  |  1997-07-24  |  2.9 KB  |  140 lines

  1. AddExtender ("wwwsk32i.dll")
  2. IntControl (35, 500, 0, 0, 0)
  3. bOK        = @TRUE
  4. sDial      = "<dialupname>"
  5. nMaxRedial = <numredials>
  6. nRedialDelay = 10
  7. sPgmPath   = "<pgmpath>"
  8. sPgmDir    = "<pgmdir>"
  9. bSendMail  = <sendmail>
  10. bEmpty     = <empty>
  11. sErrDesc   = ""
  12. nTimeout   = 30 ; How many seconds of inactivity to wait
  13.  
  14.  
  15. ;**********************************************************************
  16. ;Dial our host (unless user is on a direct connect)...
  17. ;**********************************************************************
  18. hConn = 0
  19. nNumRedials = 0
  20. if (sDial <> "")
  21.     :DialIt
  22.     hConn = DUNConnect (sDial)
  23.     nErr = SGetLastErr ()
  24.     sErr = wxGetErrDesc (nErr)
  25.     if (nErr == 633 && WinVersion(@MAJOR)==4 && WinVersion(@MINOR)==0)
  26.         ; Error 633 under NT 4.0 >really< just means we're already connected...
  27.         nErr = @SAlready
  28.         hConn = 0
  29.     else
  30.         if (nErr!=@SAlready && !hConn)
  31.             switch nErr
  32.                 case @SErrBusy
  33.                 case @SErrNoAnswer
  34.                 case 680 ; no dialtone
  35.                     if (nNumRedials <= nMaxRedial)
  36.                         nNumRedials = nNumRedials + 1
  37.                         Delay (nRedialDelay)
  38.                         goto DialIt
  39.                     endif
  40.                     break
  41.     
  42.                 case @SErrNotFound
  43.                 case @SErrVoice
  44.                 case nErr ; <--default
  45.                     sErrDesc = "Couldn't connect to %sDial%: %sErr%"
  46.                     bOK = @FALSE
  47.                     goto LogIt
  48.             endswitch
  49.         else
  50.             if (nErr == @SAlready)
  51.                 ; We're already connected. Don't hang up when this event is thru...
  52.                 hConn = 0 
  53.             endif
  54.         endif
  55.     endif
  56. endif
  57.  
  58.  
  59. ; Run Netscape & make it do things...
  60. sTitle = "Netscape"
  61. if (WinExist (sTitle))
  62.     WinActivate (sTitle)
  63. else
  64.     DirChange (sPgmDir)
  65.     Run (sPgmPath, "")
  66.     delay (2)
  67. endif
  68.  
  69.  
  70. ; Bring up the Mail window (which automatically gets new mail too)...
  71. SendKeysTo (sTitle, "!wm")
  72. Delay (10)
  73.  
  74.  
  75. if (WinExistChild(sTitle, "No new messages"))
  76.     SendKey ("~")
  77. endif
  78.  
  79. if (WinExist("Password Entry Dialog"))
  80.     WinClose ("Password Entry Dialog")
  81. endif
  82.  
  83.  
  84. ; Send outgoing mail/articles (if chosen)...
  85. if (bSendMail)
  86.     if (WinExist (sTitle))
  87.         SendKeysTo (sTitle, "!fd")
  88.     endif
  89. endif
  90.  
  91.  
  92. ; Wait for timeout on modem...
  93. nBytesMoved = wxGetInfo(3,hConn) + wxGetInfo(4,hConn)
  94. if (nBytesMoved != -1)
  95.     nTimer = 0
  96.     while (nTimer < nTimeout && WinExist(sTitle))
  97.         Delay (1)
  98.         nBytesPrev = nBytesMoved
  99.         nBytesMoved = wxGetInfo(3,hConn) + wxGetInfo(4,hConn)
  100.         if (nBytesMoved != nBytesPrev)
  101.             ; Still data being moved in this period. Reset timer...
  102.             nTimer = 0
  103.         endif
  104.         nTimer = nTimer + 1
  105.     endwhile
  106. endif
  107.  
  108.  
  109. ; If user hit Ctrl+Break, WIL will bring us here...
  110. :Cancel
  111.  
  112. ; Hang up if we're on a dial-up connection...
  113. :HangUp
  114. if (hConn)
  115.     nRet = DUNDisconnect (hConn)
  116. endif
  117.  
  118.  
  119. ; Empty the trash (if chosen)...
  120. if (bEmpty)
  121.     if (WinExist (sTitle))
  122.         SendKeysTo (sTitle, "!fe")
  123.     endif
  124. endif
  125.  
  126.  
  127. ; Log what we did...
  128. :LogIt
  129. if bOK == @TRUE
  130.     sLog = "Ran Netscape"
  131. else
  132.     sLog = strcat ("Error attempting to automate Netscape:", @CRLF, sErrDesc)
  133. endif
  134.  
  135. CMLogMessage (sLog)
  136. Display (8, "ClockMan95", sLog)
  137. exit
  138.  
  139. ~
  140.