/* $VER: PlayIt.ibrx 1.0 by Kai Nikulainen ** If you set this script as external viewer in a browser, it will play ** the file as normal and then display a requester which allows you to ** save the file. Just click on cancel if you don't want to save it. ** Needs ARexx, reqtools.library and rexxreqtools.library. ** ** Installation for Ibrowse: ** 1. Copy the script to the Ibrowse directory ** 2. Edit it so that each file type has it's own entry like shown below ** Change also the screen name to a correct value, otherwise the ** requesters appear on default public screen. ** 3. In Ibrowse/General prefs/External viewers set ** Viewer: sys:rexxc/rx ** Arguments: PlayIt.ibrx TYPE %f ** (TYPE needs to be defined below, for example AUDIO) */ parse arg type file call addlib('rexxreqtools.library',0,-30,0) title='PlayIt.ibrx 1.0 by kajun@sci.fi' tags='rt_pubscrname=PALlaced' /* Change here Ibrowse's screen name */ type.1='MPG' /* file type which must be entered before filename */ player.1='mpeg_play' /* viewer and it's options */ savedir.1='work:home' /* default directory to save the file */ type.2='AUDIO' /* You can add as many file types as you wish */ player.2='play16 >nil:' savedir.2='work:home' /* Changing something below might cause a mess */ type=strip(upper(type)) file=strip(file) if file='' then do txt='The script needs two arguments, type and filename. For example' || '0a'x txt=txt||'in Ibrowse the viewer entry for video/mpeg should be'||'0a'x txt=txt||'"rx PlayIt.ibrx MPG %%f" and for audio/midi "rx PlayIt.ibrx MIDI %%f"'||'0a'x txt=txt||'Then you need to edit the script so that it defines viewers for'||'0a'x txt=txt||'those types.' call rtezrequest(txt,,title,tags) exit end i=1 do while type.i~='TYPE.' || i if upper(type.i)=type then do address command player.i file p=max(lastpos(':',file),lastpos('/',file)) foo=substr(file,p+1) newname=rtfilerequest(savedir.i,foo,'Save file as...',,tags) if newname~='' then address command 'copy' file newname exit end i=i+1 end txt='Did not recognize type' type'!' || '0a'x || 'Create an entry for it in the script!' call rtezrequest(txt,,title,tags) exit