home *** CD-ROM | disk | FTP | other *** search
/ ftp.americansys.com / 2014.06.ftp.americansys.com.tar / ftp.americansys.com / plott / Practice.exe / 1033 / TXT / 1110 next >
Text File  |  2013-06-22  |  3KB  |  323 lines

  1. connect '/C={NX$COMMPORT}'
  2.  
  3. if result <> 2 goto connectfailure
  4.  
  5.  
  6. {NX$SHOWTT} 
  7.  
  8. settitle 'OHIP Connection'
  9.  
  10. setecho 1
  11.  
  12. lasterror = 'OK'
  13.  
  14.  
  15.  
  16. setdir '{NX$DIRECTORY}'
  17.  
  18. changedir '{NX$DIRECTORY}'
  19.  
  20. logopen '{NX$DIRECTORY}\comm.log' 0 0
  21.  
  22.  
  23.  
  24. sendln 'AT'
  25.  
  26. pause 1
  27.  
  28. sendln 'ATM1'
  29.  
  30. pause 1
  31.  
  32. sendln 'ATL3'
  33.  
  34. pause 1
  35.  
  36.  
  37.  
  38. sendln 'ATDT{NX$PHONENUM}'
  39.  
  40. timeout = 120
  41.  
  42. wait 'Please log on' 'NO CARRIER' 'BUSY'
  43.  
  44.  
  45.  
  46. if result=0 goto errtimeout_prelogin
  47.  
  48.  
  49.  
  50. if result=2 goto noconnect
  51.  
  52. if result=3 goto busy
  53.  
  54.  
  55.  
  56. timeout = 30
  57.  
  58. sendln '{NX$USERNAME}'
  59.  
  60. pause 2
  61.  
  62. ; if result=0 goto errtimeout_prelogin
  63.  
  64.  
  65.  
  66. sendln '{NX$PASSWORD}'
  67.  
  68.  
  69.  
  70. wait 'RETURN' 'Invalid' 'Enter a new'
  71.  
  72. if result=0 goto errtimeout_prelogin
  73.  
  74. if result=1 goto successfullogin
  75.  
  76. if result=2 goto badpass
  77.  
  78. if result=3 goto trychangepass
  79.  
  80.  
  81. :trychangepass
  82.  
  83. if {NX$CHANGEPASS} = 1 goto changepass
  84.  
  85. if {NX$CHANGEPASS} = 0 goto neednewpass
  86.  
  87.  
  88. :changepass
  89.  
  90. sendln '{NX$NEWPASSWORD}'
  91.  
  92. wait 'password again'
  93.  
  94. if result=0 goto errtimeout_prelogin
  95.  
  96. sendln '{NX$NEWPASSWORD}'
  97.  
  98.  
  99. wait 'RETURN' 'Invalid' 'do not match' 'previously used'
  100.  
  101. if result=0 goto errtimeout_prelogin
  102.  
  103. if result=1 goto successfullogin
  104.  
  105. if result=2 goto badpass
  106.  
  107. if result=3 goto badpass
  108.  
  109. if result=4 goto enteredoldpass
  110.  
  111.  
  112.  
  113. :successfullogin
  114.  
  115. sendln ''
  116.  
  117.  
  118.  
  119. wait 'Service'
  120.  
  121. if result=0 goto errtimeout
  122.  
  123.  
  124.  
  125. sendln '1'
  126.  
  127.  
  128.  
  129. wait '10-DOWNLOAD'
  130.  
  131. if result=0 goto errtimeout
  132.  
  133.  
  134.  
  135. send '**********Z'
  136.  
  137. send #$1B
  138.  
  139. send #$30
  140.  
  141.  
  142. iReportsDownloaded = 0
  143.  
  144.  
  145. :trydownload
  146.  
  147. wait 'PREPARE' 'Service'
  148.  
  149. if result=1 goto download
  150.  
  151. if result=2 goto deletereports
  152.  
  153. if result=0 goto errtimeout
  154.  
  155.  
  156. :download 
  157.  
  158. zmodemrecv
  159.  
  160. if result=0 goto downloaderror
  161.  
  162. pause 2
  163.  
  164. sendln ''
  165.  
  166. iReportsDownloaded = iReportsDownloaded + 1
  167.  
  168. goto trydownload
  169.  
  170.  
  171.  
  172. :deletereports
  173.  
  174. {NX$SKIPDELETEREPORTS}
  175.  
  176.  
  177. if iReportsDownloaded = 0 goto logoff
  178.  
  179.  
  180. sendln '1'
  181.  
  182. wait '10-DOWNLOAD'
  183.  
  184. if result=0 goto errtimeout
  185.  
  186. send '**********Z'
  187.  
  188. send #$1B
  189.  
  190. send #$39
  191.  
  192. sendln 'Yes'
  193.  
  194. pause 2
  195.  
  196. send #$1B
  197.  
  198. send #$33
  199.  
  200. wait 'Service'
  201.  
  202. if result=0 goto errtimeout
  203.  
  204.  
  205.  
  206. :logoff
  207.  
  208. sendln '4'
  209.  
  210. if iReportsDownloaded > 0 then
  211.  
  212.     lasterror = 'Reports have been successfully downloaded.'
  213.  
  214.     setexitcode 1
  215.  
  216. else
  217.  
  218.     lasterror = 'No reports are available to download.'
  219.  
  220.     setexitcode 2
  221.  
  222. endif
  223.  
  224. goto end
  225.  
  226.  
  227.  
  228. :errtimeout
  229.  
  230. lasterror = 'Error: Timeout'
  231.  
  232. setexitcode -1
  233.  
  234. goto end
  235.  
  236.  
  237.  
  238. :noconnect
  239.  
  240. lasterror = 'No Answer'
  241.  
  242. setexitcode -2
  243.  
  244. goto end
  245.  
  246.  
  247.  
  248. :busy
  249.  
  250. lasterror = 'Line Busy'
  251.  
  252. setexitcode -3
  253.  
  254. goto end
  255.  
  256.  
  257.  
  258. :badpass
  259.  
  260. lasterror = 'Invalid password'
  261.  
  262. setexitcode -4
  263.  
  264. goto end
  265.  
  266.  
  267.  
  268. :downloaderror
  269.  
  270. lasterror = 'Reports download failed.'
  271.  
  272. setexitcode -5
  273.  
  274. goto end
  275.  
  276.  
  277. :connectfailure
  278.  
  279. lasterror = 'Failed to connect to modem.'
  280.  
  281. setexitcode -6
  282.  
  283. goto end
  284.  
  285.  
  286. :neednewpass
  287.  
  288. lasterror = 'A new password is needed.'
  289.  
  290. setexitcode -7
  291.  
  292. goto end
  293.  
  294.  
  295. :enteredoldpass
  296.  
  297. lasterror = 'Cannot use old passwords.'
  298.  
  299. setexitcode -8
  300.  
  301. goto end
  302.  
  303.  
  304. :errtimeout_prelogin
  305.  
  306. lasterror = 'Error: Timeout Before Login'
  307.  
  308. setexitcode -9
  309.  
  310. goto end
  311.  
  312.  
  313. :end
  314.  
  315. disconnect
  316.  
  317. logclose
  318.  
  319. closett
  320.  
  321. messagebox lasterror 'Download Process Completed'
  322.  
  323.