/* GrabURL.rexx v1.2 - 19-Nov-96 This script grabs all URLs from the current message and displays them in a requester. From that requester you can send the URL to your browser. Currently supported browsers are AWeb, IBrowse and Voyager. All adresses which end with a character in variable dup_chars will be duplicated and displayed also without that character. The script requires rexxreqtools.library and reqtools.library. Send bug reports, comments and spare bodyparts to knikulai@utu.fi If you send a message with subject REQUEST INDEX, you'll get a list of my AREXX scripts. REQUEST will get you the script you want. */ options results addlib('rexxreqtools.library',0,-30) dup_chars='.,!?"*%&)' /* If one of these ends the URL, it will be duplicated */ wid=70 /* how many characters of the URL is shown? */ maxbut=17 /* How many buttons fit the screen ? */ maxurl=18 /* How many lines of URLs fit the screen ? */ title='GrabURL.rexx by knikulai@utu.fi' not_found='Sorry, could not find any URLs!' found_these='The following URLs were found:' error_msg='Could not open file for reading!' NL='0a'x /* newline */ uc=0 /* URL-counter */ address 'YAM' GetMailInfo File fname=result if open(msg,fname,'R') then do do until eof(msg) | uc=maxurl rivi=readln(msg) rivi=rivi || ' ' /* Just making sure there is a space at the end */ do while uc0 | pos('HTTP://',upper(rivi))>0 | pos('FTP://',upper(rivi))>0) /* There might be several URLs on one line */ b=pos('HTTP://',upper(rivi)) /* beginning */ if b=0 then b=pos('FTP://',upper(rivi)) /* Adding other types is easy, just add a line like this: */ if b=0 then b=pos('FILE://',upper(rivi)) e=pos(' ',rivi,b) /* ending space */ call AddURL(substr(rivi,b,e-b)) /* save URL */ do while pos(right(url.uc,1),dup_chars)>0 /* Add another URL without the last character */ spare=left(url.uc,length(url.uc)-1) call AddURL(spare) end rivi=right(rivi,length(rivi)-e) end /* do until pos('HTTP://'*/ end /* do until eof(msg) */ if uc=0 then call rtezrequest(not_found,,title) else do body=found_these || NL buttons='' do i=1 to uc if i<10 then shortcut='_' else shortcut='' if i<=maxbut then buttons=buttons || shortcut || i || '|' body=body || i || ') ' if length(url.i)<=wid then body=body || url.i || NL else body=body || left(url.i,40) || '...' || right(url.i,wid-43) || NL end /* do i=1 to uc */ buttons=buttons || '_Ok' sel=rtezrequest(body,buttons,title,'rtez_defaultresponse=0') if sel>0 then do lst=show('P') || ' ' if pos('MINDWALKER',lst)>0 then address 'MINDWALKER' 'OpenURL '|| url.sel if pos('VOYAGER',lst)>0 then address 'VOYAGER' 'OpenURL '|| url.sel if pos('IBROWSE',lst)>0 then address 'IBROWSE' 'GotoURL ' || url.sel if pos('AWEB',lst)>0 then do address value substr(lst,pos('AWEB.',lst),6) 'Open ' || url.sel end end /* if sel>0 then do */ end /* else */ end else call rtezrequest(error_msg,,title) exit AddURL: parse arg u do i=1 to uc if url.i=u then return end uc=uc+1 url.uc=u return