/*) Template for GV Arexx writers to get data returned from GV \\\ Written by Josef Faulkner (panther@gate.net) IRC: Josef /// \\\ Special Notes: /// ~~~~~~~~~~~~~~ \\\ HACK ALERT - Be Careful! /// \\\ This is the first program I am distributing that uses the "scan log" /// feature to get results back from grapevine. Some precautions must be \\\ taken for this to work, or to prevent from banning the wrong person: /// \\\ 1. DO NOT use the /who command between the time you issue the /xban command /// and the ban is actually put into place. This could result in the person you \\\ do a /who on, getting banned instead. /// \\\ 2. You cannot use logs, if you have a log running, it will be stopped when /// this program is executed \\\ /// 3. Dont try to do this command more than twice in a row until the \\\ results from the previous one are displayed. This is necessary for /// the same reason as #1 above. \\\ /// Technical Notes: \\\ ~~~~~~~~~~~~~~~~ /// This program calls itself again, because the logs cant be used on scripts \\\ directly called from GV. If you find your server is slow, increase the /// delay() value. If you find that the results take too long, and the who \\\ info returns fairly quickly, decrease it. (*/ options results if ~show('L','rexxsupport.library') then if ~addlib('rexxsupport.library',0,-30,0) then do /* Needed for delete() */ parse arg cmds /* Read in arguments */ if word(cmds,1)~='¶' then do /* We use ¶ as an escape code to know we relaunched the script */ /* If there was no escape code, we need to relaunch (this do) */ parse source . .' 'thisscript' '. /* returns the complete pathname and name of this running arexx script */ address command 'run >NIL: rx' thisscript '¶' address() cmds /* Relaunches the script passing the escape code as well as all of */ /* our arguments */ exit /* Quit this script, now we are asynchronously running */ end else do parse var cmds .' 'addr' 'arg1' 'arg2' 'arg3' '. /* set arguments accordingly, remove ' '. at the end for the las argument to be all remaining words */ address(addr) call delete('t:data.log') /* always delete the old log first, as GV logs in append mode */ 'log t:data.log' 'names' /* or whatever command you want to capture */ 'closelog' call open(1,'t:data.log',r) /* numerical file handles are easier to type :) */ do until eof(1) text=readln(1) if word(text,1)='«Names»' then call dostuff /* Verify the line youre looking for */ end call close(1) end exit DOSTUFF: 'echo' text return