home *** CD-ROM | disk | FTP | other *** search
/ Amiga Times / AmigaTimes.iso / internet / stricq / rexx / notify_stricq.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-10-06  |  3.7 KB  |  143 lines

  1. /* Arexx script for StrICQ triggered by the notify event that will use
  2. the Amiga's narrator.device to inform you who sent you the last msg.
  3.  
  4. $VER:release v0.5 july-6th-1998 by Eric Giroux (eric_giroux@videotron.ca)
  5.  
  6. PLay16 by Thomans Wenzel (http://linux.rz.fh-hannover.de/~wenzel/programming.html)
  7. and translator.library are required.
  8.  
  9. Simply put that script in StrICQ's "settings/prefs/stricq/message notify command & online"
  10. rx rexx/notify_stricq.rexx %ld msg"
  11. rx rexx/notify_stricq.rexx %ld online"
  12. rx rexx/notify_stricq.rexx 0 system"
  13.  
  14. Put contacts.prefs in the same drawer as notify_stricq.rexx and modify
  15. it to reflect your contact list.  The first argument is the UIN and
  16. the second, after the comma, is the name you want the translator to
  17. speak.
  18.  
  19. You'll have to change 6 variables in notify_stricq.prefs
  20.  
  21. TALKTO variable to your first name.
  22. SAY_COMMAND variable to reflect the path on your system.
  23. SAMPLE_MSG variable to the sample you want to hear as general notification.
  24. SAMPLE_ONLINE variable to the sample you want to hear when someone is online.
  25. SAMPLE_SYSTEM variable to the sample you want to hear when there's a system message.
  26. PLAYER variable to reflect the one you use.
  27. */
  28.  
  29. options results
  30.  
  31.  
  32. if show(P,'STRICQ_NOTIFICATION_REXX') then do
  33.    DO WHILE Show('p','STRICQ_NOTIFICATION_REXX') = 0
  34.     Call Delay 120
  35.    End
  36.   end
  37.  else
  38.   msg_port=openport('STRICQ_NOTIFICATION_REXX')
  39.  
  40. found="0"
  41. port=address()
  42.  
  43. curdir=pragma('d')
  44. if right(curdir,1) ~= ":" then prefs=curdir"/rexx/Contacts.prefs"
  45.  else prefs=curdir"rexx/Contacts.prefs"
  46.  
  47. stricq.prefs_file=curdir"/rexx/notify_stricq.prefs"
  48.  
  49. if exists(stricq.prefs_file)=1 then
  50.  open('prefs_file',stricq.prefs_file,r)
  51.   do while ~eof('prefs_file')
  52.    line=readln('prefs_file')
  53.    if index(line,'/*') =0 & if index(line,'=') ~=0 & index(line,'*/') =0 then
  54.      interpret line
  55.     else
  56.      iterate
  57.   end
  58.  
  59. say_command=center(say_command,length(say_command)+2,'"')
  60.  
  61. if ~show('L','rexxsupport.library') then
  62.   if addlib('rexxsupport.library',0,-30,0)=0 then exit
  63.  
  64. if ~exists('libs:translator.library') then exit
  65.  
  66. options results
  67.  
  68. parse upper arg UIN " " NOTIFICATION
  69.  
  70. if UIN="" then exit
  71.  
  72.  
  73.  
  74. if exists(sample_msg)=1 & exists(player)=1 & exists(sample_online) then do
  75.  select
  76.   when upper(notification)='MSG' then do
  77.     address command player ' <>nil: ' sample_msg
  78.     say_nick(MSG)
  79.    end
  80.   when upper(notification)='ONLINE' then do
  81.     address command player ' <>nil: ' sample_online
  82.     say_nick(ONLINE)
  83.    end
  84.   when upper(notification)='SYSTEM' then
  85.     address command player ' <>nil: ' sample_system
  86.  
  87.    otherwise
  88.     break
  89.  end
  90. end
  91.  
  92. if show(P,'STRICQ_NOTIFICATION_REXX') then
  93.   msg_port=closeport('STRICQ_NOTIFICATION_REXX')
  94.  
  95. exit
  96.  
  97.  
  98. say_nick:
  99. parse arg notify_type
  100.  
  101. if exists(prefs)=1 then do
  102.   if open(notify_prefs_file,prefs,r) = "0" then exit
  103.   nlines="1"
  104.   do while ~eof(notify_prefs_file)
  105.    nick.nlines=readln(notify_prefs_file)
  106.    if nick.nlines="" then iterate
  107.     else do
  108.      if index(nick.nlines,UIN) >= 1 then do
  109.       if exists(compress(SAY_COMMAND,'"'))=1 then do
  110.        select
  111.         when upper(notify_type)='MSG' then
  112.          address command say_command d2c(34) talkto ',,,you have a message from,' spoken_nick(nick.nlines) ',on  I see cue.' d2c(34)
  113.  
  114.         when upper(notify_type)='ONLINE' then
  115.          address command say_command d2c(34) talkto ',,,' spoken_nick(nick.nlines) ',is online.' d2c(34)
  116.        end
  117.       end
  118.       found=found+1
  119.      end
  120.      nlines=nlines+1
  121.     end
  122.   if found="1" then leave
  123.   end
  124.  nick.0=nlines-1
  125.  close(notify_prefs_file)
  126. end
  127. return notify_type
  128.  
  129. spoken_nick:
  130.  parse arg new_nick
  131.     new_nick=substr(new_nick,lastpos(',',new_nick)+1)
  132. return new_nick
  133.  
  134. PubScreen:
  135.  If show('p', port) = 1 then do
  136.   address value port
  137.   INFO SCREEN
  138.   PubScreen = result
  139.  end
  140.   else
  141.  PubScreen = 'Workbench'
  142. return pubscreen
  143.