home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 3 / PDCD_3.iso / pocketbk / utilsm / np52 / RUN3CIS.ZIP / RUN3CIS.MCR < prev    next >
Text File  |  1995-06-26  |  4KB  |  129 lines

  1. #define GeneralManager  $008b
  2. #define GenEnvBufferGet $2100
  3. #define GenEnvBufferSet $2200
  4.  
  5.  
  6. Proc Macro:
  7. local d$(2),s$(2),changed%,var$(129),rname$(129)
  8. rname$="m:\cis\config\readCIS.nam"         /* Default .nam file   */
  9.  
  10. d$=ff$:("\app\readcis\threecis.sco")       /* Look for Threecis script */
  11. if d$=""                                   /* Script Not found */
  12.         error:
  13.         return
  14. endif
  15.  
  16. s$=ff$:("\Cis\Switch\autoexec.on")         /* Script found on s$  */
  17. if s$=""
  18.         s$=ff$:("\Cis\Switch\autoexec.off")
  19.         if s$<>""
  20.                 trap rename s$+"\Cis\Switch\autoexec.off",s$+"\Cis\Switch\autoexec.on"
  21.         else
  22.                 trap mkdir "M:\Cis\Switch"
  23.                 lopen "M:\cis\switch\autoexec.on"  /* Make autoexec switch */
  24.                 lclose                             /* We need this to run unattended */
  25.         endif
  26. endif
  27.  
  28. var$=environ$:("C$N",1,"")                 /* Get current environment variable */
  29. if loc(var$,"readcis.nam")=0               /* if it's not readcis.nam */
  30.         environ$:("C$N",2,rname$)          /* Set it */
  31.         changed%=1
  32. endif
  33.  
  34. launch:(d$+"\app\readcis\threecis.sco")    /* Launch script */
  35. pause 15*20                                /* Important - wait for script to start */
  36. if changed%
  37.        environ$:("C$N",2,var$)             /* Change it back to what it was */
  38. endif
  39. Endp
  40.  
  41. PROC launch:(sco$)
  42.     local pid%
  43.     local cmdl$(128),appname$(128)
  44.     local ret%
  45.     if exist("LOC::c:\App\Fcomms.app")          /* Check for 3fax first */
  46.         appname$="LOC::C:\APP\FCOMMS.APP"+chr$(0)
  47.     elseif exist("ROM::comms.app")              /* Check ROM second */
  48.         appname$="ROM::COMMS.APP"+chr$(0)
  49.     elseif exist("LOC::c:\App\comms.app")       /* Lastly check 3link */
  50.         appname$="LOC::C:\APP\COMMS.APP"+chr$(0)
  51.     else beep 5,450 :return
  52.     endif
  53.     cmdl$="OComms"+chr$(0)+".SCO "+chr$(0)+sco$+chr$(0)
  54.     ret%=call($0187,addr(appname$)+1,addr(cmdl$),0,0,addr(pid%))
  55.     if ret%<0
  56.         pid%=0
  57.         error:
  58.     else
  59.         call($0688,pid%,0,0,0,0)
  60.     endif
  61.     return pid%
  62. ENDP
  63.  
  64. Proc FF$:(p$)           /* Checks all drives for a file */
  65. local dr$(3,2),l%
  66. dr$(1)="M:" :dr$(2)="A:" :dr$(3)="B:"
  67. onerr fe
  68. l%=1
  69. top::
  70. do
  71.  if exist(dr$(l%)+p$)
  72.   return dr$(l%)
  73.  endif
  74.  l%=l%+1
  75. until l%>3
  76. return ""
  77. fe::
  78. l%=l%+1
  79. if l%<4
  80.  goto top
  81. endif
  82. Endp
  83.  
  84. Proc environ$:(var$,mode%,new$)         /* Get or Set Environment var */
  85.                                         /* mode 1 = Get,  mode 2 = Set */
  86.         LOCAL ax%,bx%,cx%,dx%,si%,di%   /* Set needs CL=Length of new name */
  87.     LOCAL flags%
  88.  
  89.         LOCAL env$(8),penv%,lenenv%
  90.         LOCAL pbuff%,lenbuff%
  91.         Local name$(129)
  92.  
  93.         env$    = var$
  94.     penv%   = ADDR(env$) + 1
  95.     lenenv% = LEN(env$)
  96.  
  97.         pbuff% = ADDR(name$)+1
  98.  
  99.         if mode%=1
  100.                 ax% = GenEnvBufferGet
  101.         elseif mode%=2
  102.                 ax% = GenEnvBufferSet
  103.                 name$=new$
  104.                 cx%=len(name$)          /* Set length of new name */
  105.         endif
  106.     bx% = 0
  107.     di% = penv%
  108.     dx% = lenenv%
  109.     si% = pbuff%
  110.  
  111.     flags% = OS(GeneralManager,ADDR(ax%))
  112.  
  113.     IF flags% AND 1
  114.                 error:
  115.                 return ""
  116.     ELSE
  117.                 if mode%=1
  118.                         lenbuff% = ax%
  119.                         POKEB ADDR(name$),lenbuff%
  120.                 endif
  121.                 return name$
  122.     ENDIF
  123.     
  124. ENDP
  125.  
  126. Proc Error:
  127. beep 10,450
  128. Endp
  129.