/************************************************************************/ /* Exec1 */ /* ======= */ /* */ /* This EXEC will attempt to auto-execute a file based on its file- */ /* type. Filetypes recognized are listed at the start of the exec. */ /* Can be included in another ARexx macro or called from one. */ /* This is special version for use with ArexxMenu.rexx. */ /* Steven D. Kapplin */ /* 11/2/90 */ /************************************************************************/ trace off /* Disable ARexx tracing */ parse upper arg fname wind /* Get file name */ if fname = '' then do /* No filename passed? */ return 5 end /* Define some frequently used program names */ /* Be sure to allow for space at end of name */ textviewer = "Run Sys:Tools/Type " pictureviewer = "Run Sys:Tools/Superview " unzoo = "c:archivers/Zoo " unarc = "c:archivers/Arc " unlzh = "c:archivers/LHarc " arcdir = "VD0:" playsound = "Run Sonica " player = "Run Dpaint:Play " editor = "sys:CEdit " /* Define location of requestor at middle of screen */ /* Filetype identifiers */ EXE = "F3" /* Executable */ PIC = "494C424D424D4844" /* IFF Picture File */ XCEL = "4654585450534554" /* Excellence! File */ PROW = "574F5244464F4E54" /* ProWrite File */ ADV = "04F404F404F404F4" /* Advantage Worksheet */ MAXI = "474C424C" /* MaxiPlan Worksheet */ CAND = "4445434B414E4E4F" /* CanDo Deck */ SND = "3853565856484452" /* 8SVX Sound File */ PPG = "0708090D" /* Professional Page 1.3 File */ PGS = "07231988000D0200" /* PageStream 1.8 File */ ANIM = "414E494D464F524D" /* Anim File */ DYN = "44594350" /* DigiPaint DYN */ LZH = ".LZH" /* LHarc Archive */ ARC = ".ARC" /* Arc Archive */ ZOO = ".ZOO" /* Zoo Archive */ ZIP = ".ZIP" /* PKaZip File (nothing yet implemented) */ RXX = ".REXX" /* ARexx macro */ /*----------------------------------*/ /* Open passed filename and read first 256 bytes */ call open(f,fname,'R') instring = c2x(readch(f,256)) call close(f) result = 2 select /* Process file */ when substr(instring,217,8) = DYN then cmd = 'Run Dyna-Show ' when substr(instring,7,2) = EXE then cmd = 'Run ' when substr(instring,17,16) = PROW then cmd = 'Run ProWrite:Prowrite ' when substr(instring,17,16) = PIC then cmd = pictureviewer || '-c ' when substr(instring,17,16) = XCEL then cmd = 'Run Excellence!:Excellence! ' when substr(instring,1,16) = ADV then cmd = 'Run Advantage:Advantage ' when substr(instring,1,8) = MAXI then cmd = 'Run MaxiPlan:MaxiPlan-III ' when substr(instring,17,16) = ANIM then cmd = player when substr(instring,17,16) = CAND then do pragma('D','CanDo:') cmd = 'Run DeckRunner' end when substr(instring,17,16) = SND then cmd = playsound when substr(instring,1,8) = PPG then cmd = 'Run PPage:PPage' when substr(instring,1,16) = PGS then cmd = 'Run PageStream:PageStream ' when pos(ZIP,fname) > 0 then cmd = "c:archivers/PKaZip " when pos(RXX,fname) > 0 then cmd = "" when pos(LZH,fname) > 0 then do pragma('D',arcdir) result = MsgThree(wind,'Unarc or List?','Unarc=OK','List=NO') if result = 1 then cmd = unlzh || "-a -m -x x " else cmd = unlzh || " l " end when pos(ARC,fname) > 0 then do pragma('D',arcdir) result = MsgThree(wind,'Unarc or List?','Unarc=OK','List=NO') if result = 1 then cmd = unarc || "x " else cmd = unarc || " l " end when pos(ZOO,fname) > 0 then do pragma('D',arcdir) result = MsgThree(wind,'Unarc or List?','Unarc=OK','List=NO') if result = 1 then cmd = unzoo || "e// " else cmd = unzoo || " l " end otherwise do do i = 1 to 32 by 2 s = substr(instring,i,2) if s ~= "0A" & s ~= "0D" & s < "20" | s > "7F" then do cmd = "" result = MsgOne(wind,"Don't Recognize File Type") return 5 end end result = MsgThree(wind,'Edit or View?','Edit=OK','View=NO') if result = 1 then cmd = editor else cmd = textviewer || " " end end if ~exists(fname || '.info') then cmd = 'runf1 'cmd'' address command cmd fname /* Build command line */ return 0