/* Introduction ------------ This little program should be named MultiView and placed in the C: directory or somewhere else in the search path. It was written out of frustration. If you are using OS 2.x and often download archives from Aminet or the like, you probably know this situation: doubleclick on an icon and a requester pops up "program multiview cannot be located". This is especially annoying for CDs, because it is impossible to change the default tool. Here is where this program comes in. It is called instead of the 3.x MultiView and there is a pre-configured viewer that you like best for all the usual file extensions. How to use it? -------------- Very simple, if you have AmigaE by Wouter van Oortmerssen. Thanks Wouter for this incredible piece of software and the support! It was written using version 3.1a, but might work with earlier versions too. (If not, get the latest version from Aminet and try the demo and register afterwards 8-) ) I put in my favourite viewers (players can also be used). To change that, just edit the source code to fit your needs and compile it. As the last step, put it in your C: directory as MultiView. Then you are set. In addition, I created a Toolmanager dock for my program. That makes it possible to simply drag a document on this icon and it is viewed. (great for readme files on Aminet CDs without icons) Requirements ------------ - Amiga computer (kind of obvious) - enough memory to load the program and to display all the requesters (and for the viewers and data as well) - OS 2.x (3.x and more comes with a real MultiView, so why bother?) Some problems ------------- - viewers must be in C: or complete path must be coded, when used from WB (DOS.library`s Execute function related) (any ideas for fixing, please contact me) - doesn`t replace OS 3.x data types (it doesn`t even try 8-( ) - no external prefs file/program (faster for same reason) data types do not change very often - can handle only commands up to 512 characters (including parameters, quotes, spaces, colons, slashes ...) (max. CLI command length is 512) - file needs to have an extension (.something) to recognize file type (currently up to 6 characters) otherwise the requester for unknown file types comes up Legal Stuff ----------- This program was written, using some example routines from the AmigaE_v3.1a package, (thanks again to Wouter) by: Horst Schumann Helmstedter Str. 18 39167 Irxleben Germany e-mail: hschuman@cs.uni-magdeburg.de WWW: http://www.cs.uni-magddeburg.de/~hschuman/hschuman.html (links only) I call it anythingware (same as giftware)! Everybody can use it, modify it, compile it, re-release it, etc. provided he/she (Are there any girls using the Amiga? I'd love to hear from you!) sends me anything like e-mails, postcards, letters, money, Amiga equipment, Amigas (no PCs, please!), etc., but if you can`t afford any of it, please use it anyway, it might be useful. Own programs, especially those of the useful kind, are very much welcome too (uncrippled of course). And now the standard disclaimer ------------------------------- NO WARRANTY If something happens and you don`t want it, blame somebody else! History ------- This release got some requesters added in case the file type is unknown. Instead of using the default viewer a custom viewer can be selected. Future Plans? ------------- Who knows what the future will bring... */ OPT OSVERSION=37 MODULE 'workbench/startup','Asl','libraries/Asl' PROC get_extension(string,extension) DEF pos pos:=StrLen(string)-1 WHILE string[pos]<>"." pos-- ENDWHILE MidStr(extension,string,pos+1) ENDPROC PROC get_command(extension,command) -> edit for own commands LowerStr(extension) IF StrCmp(extension,'guide') StrCopy(command,'amigaguide "') ELSEIF StrCmp(extension,'doc') StrCopy(command,'muchmore "') ELSEIF StrCmp(extension,'txt') StrCopy(command,'muchmore "') ELSEIF StrCmp(extension,'readme') StrCopy(command,'muchmore "') ELSEIF StrCmp(extension,'iff') StrCopy(command,'work:utilities/display "') ELSEIF StrCmp(extension,'ham') StrCopy(command,'work:utilities/display "') ELSE unknown_type(command) ENDIF ENDPROC PROC unknown_type(command) DEF result,req:PTR TO filerequester result:=EasyRequestArgs(0,[20,0, 'MV2.x', 'Filetype unknown!', 'Use Default Viewer|Select Viewer'], 0,NIL) IF result=1 StrCopy(command,'muchmore "') ELSE IF aslbase:=OpenLibrary('asl.library',37) IF req:=AllocAslRequest(ASL_FILEREQUEST, [ASLFR_TITLETEXT,'Select viewer', ASLFR_POSITIVETEXT,'Use this viewer', ASLFR_NEGATIVETEXT,'Use default viewer', ASLFR_INITIALFILE,'MuchMore', ASLFR_INITIALDRAWER,'C:', ASLFR_REJECTICONS,TRUE, 0,0]) IF AslRequest(req,0) StrCopy(command,req.drawer) IF command[StrLen(command)-1]<>":" StrAdd(command,'/') ENDIF StrAdd(command,req.file) StrAdd(command,' "') ELSE StrCopy(command,'muchmore "') ENDIF FreeAslRequest(req) ELSE EasyRequestArgs(0,[20,0, 'MV2.x', 'Could not open file requester!', 'Use default viewer'], 0,NIL) ENDIF CloseLibrary(aslbase) ELSE EasyRequestArgs(0,[20,0, 'MV2.x', 'Could not open Asl library!', 'Use default viewer'], 0,NIL) ENDIF ENDIF ENDPROC PROC main() DEF wb:PTR TO wbstartup -> pointer to WBstartup object DEF wbargs:PTR TO wbarg -> pointer to WBarg object DEF a -> just a counter DEF template -> template for CLI argument parsing DEF rdargs -> flag for ReadArgs result DEF cliargs=NIL:PTR TO LONG -> pointer for ReadArgs arguments DEF command[512]:STRING -> max. CLI command length is 511 DEF currentdir -> save current dir when run from WB DEF ext[6]:STRING -> extension IF wbmessage=NIL -> started from CLI template:='FILE/M' rdargs:=ReadArgs(template,{cliargs},NIL) IF rdargs IF cliargs a:=0 WHILE cliargs[a] -> Loop through arguments IF InStr(cliargs[a],'.') > -1 get_extension(cliargs[a],ext) get_command(ext,command) -> execute command ELSE unknown_type(command) ENDIF StrAdd(command,cliargs[a]) StrAdd(command,'"') Execute(command,0,stdout) -> execute command a++ ENDWHILE ENDIF FreeArgs(rdargs) ENDIF ELSE -> started from WB wb:=wbmessage currentdir:=CurrentDir(wbargs[0].lock) wbargs:=wb.arglist FOR a:=1 TO wb.numargs-1 IF InStr(wbargs[a].name,'.') > -1 get_extension(wbargs[a].name,ext) get_command(ext,command) -> select command for extension ELSE unknown_type(command) ENDIF CurrentDir(wbargs[a].lock) -> change to target dir StrAdd(command,wbargs[a].name) StrAdd(command,'"') Execute(command,0,stdout) -> execute command ENDFOR CurrentDir(currentdir) -> restore old current dir ENDIF ENDPROC