home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / arexx / parnet / gpc.rexx
OS/2 REXX Batch file  |  1997-03-30  |  4KB  |  165 lines

  1. /* GiGA Parnet Chatter ©1996 by Fini 'Warp' Alring of GiGA Productions...
  2. **
  3. ** Start the server task in you ParNET-startup.:
  4. **      Run >NIL: Rx GPC.rexx Delay  ; (I use a delay of 100, 2 secs).
  5. **
  6. ** Assign the following line to a HOTKEY or alike...:
  7. **      Run >NIL: Rx GPC.rexx * Username  ; (I use Warp as Username)
  8. **
  9. ** Note: Both machines MUST have the server task started. 
  10. **
  11. ** BUGS: None, he! he!
  12. **   BUT GPC can only cope with one message at a time, so no mega flaming OK!
  13. **   Coz then you'll lose the previous message.
  14. **   It sometimes doesn't work, but maybe it was set up incorrectly. ;-D
  15. **
  16. ** HINT: Set delay lower, to make GPC respond faster, thus more flaming!
  17. **       Also I think it's a good idea to set each delay approx. equal... 
  18. **
  19. ** Future:
  20. ** When I try out a networking facility with more computers on, I will
  21. ** make a version to chat with the different users, and maybe all!!! :·)
  22. **
  23. ** Required libraries:
  24. **
  25. ** reqtools.library, rexxreqtools.library, rexxsupport.library.
  26. **
  27. ** They should all be available at AmiNET, if you don't have them.
  28. */
  29.  
  30.  
  31. Xver = 'v1.2'
  32.  
  33. Parse arg D Username
  34.  
  35. if length(D) = 0 then do
  36.     say ''
  37.     say ' The GiGA Parnet Chatter ' Xver '©-1996 by Fini 'Warp' Alring of GiGA Prod...'
  38.     say ' Type "Run >NIL: Rx GPC.rexx Delay" to start the server task.'
  39.     say ' Type "Run >NIL: Rx GPC.rexx * Username" to bring up, a string requester...'
  40.     say " Do this on both computers, and you'll be able to send messages over the net!!!"
  41.     say ''
  42.     say 'Delay = 50th/Sec. - Choose how often the mailbox should be examined...'
  43.     Say 'Username = e.g. Warp - The username will pop up with the notes you send...'
  44.     say 'Read top of source, for more info...'
  45.     say ''
  46.     exit
  47. end
  48.  
  49.  
  50. call initlibs
  51.  
  52.  
  53. if D = '*' then do
  54.     
  55.     if show('p','GPC') then do  
  56.         
  57.             Str1 = rtgetstring('',,'GiGA Parnet Chatter v1.0',"_Send|_Abort","rtgs_flags = gsreqf_centertext|gsreqf_highlighttext rt_reqpos = reqpos_centerscr")
  58.             
  59.             if rtresult = 1 then do
  60.                 Username = centre(Username,60)
  61.         
  62.                 Address command "C:Echo "Username" >Net:ram/Parnet.chat"
  63.                 Address command "C:Echo "Str1" >>Net:ram/Parnet.chat"
  64.         /*
  65.                 Address command "C:Echo "Username" >ram:Parnet.chat"
  66.                 Address command "C:Echo "Str1" >>ram:Parnet.chat"
  67.         */        
  68.             end
  69.     end        
  70.     else do
  71.         call popreq('Please start the server first...','GiGA')
  72.     end
  73.     
  74.     exit 0
  75. end
  76.  
  77.  
  78. Boot = 1
  79. do forever
  80.  
  81.     if boot = 1 then do
  82.         Success = Openport('GPC')
  83.         if Success ~= 1 then do
  84.             Call Popreq(centre('GPC is already running on your Amiga!',60),'The GiGA Parnet Chatter 'Xver)
  85.             exit 10
  86.         end
  87.  
  88.         Call Popreq(centre('GPC is now running on your Amiga!',60),'The GiGA Parnet Chatter 'Xver)
  89.         
  90.     Boot = 0
  91.     end
  92.  
  93.     do while exists('ram:Parnet.chat') ~= 1
  94.         Call Delay(D)    
  95.     end
  96.     
  97.     success = open(FILE,'ram:Parnet.chat','r')
  98.     
  99.     Username = readln(FILE)
  100.     
  101.     Str1 = readln(FILE)
  102.     
  103.     call popreq(Str1,Username) 
  104.     
  105.     Call close(File)
  106.  
  107.     Address command "C:Delete ram:Parnet.chat quiet"
  108.  
  109. end
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116. /* Functions() ***************************************************************/
  117.  
  118.  
  119. Initlibs:
  120.  
  121.     a=0
  122.  
  123.     If exists('LIBS:rexxreqtools.library') ~= 1 then do
  124.             Say 'Unable to open rexxreqtools.library'
  125.             a=1
  126.     end
  127.     
  128.     If exists('LIBS:reqtools.library') ~= 1 then do
  129.             Say 'Unable to open reqtools.library'
  130.             a=1
  131.     end
  132.  
  133.     If exists('LIBS:rexxsupport.library') ~= 1 then do
  134.             Say 'Unable to open rexxsupport.library'
  135.             a=1
  136.     end
  137.     
  138.     if a=1 then do
  139.         say 'Unable to run:'
  140.         say Title
  141.         say 'Get the libraries listed above, you will need them/it...'
  142.         exit 20
  143.     end
  144.     
  145.     call addlib("rexxsupport.library", 0, -30, 0)
  146.     call addlib("rexxreqtools.library", 0, -30, 0)
  147. /*  ^- Libs R found, now we link the reqtools.lib via rexxreqtools.lib */
  148.  
  149. Return
  150. /*
  151. **           ^- Check for needed libraries, and react upon...   
  152. */
  153.  
  154.  
  155.  
  156.  
  157. PopReq: Parse arg MESS, USERNAME
  158.     s = 'Message from ' USERNAME
  159.     Call RTezrequest(MESS,'Done!',s,"rt_reqpos =reqpos_centerscr")
  160. return 0
  161.  
  162. /*
  163. **           ^- Pop a requester, with a message...   
  164. */
  165.