;************************************************************************ ; This Command Post menu file creates a STANDALONE Windows front-end for* ; some of the Norton Advanced Utilities version 4.50. * ; * ;WHAT? You DON'T have Command Post, the best custom menu system for * ;MS Windows? It's available on finer BBS'es the world over. Or call * ;Wilson WindowWare @ (800)762-8383 & order your registered copy today! * ;************************************************************************ ; Jennifer Palonus 08jun90 ;This file is similar to WINORTON.CPM, except a subset of CMDPOST.CPM has ;been added to the beginning so you can run this menu alone. ;These menus call The Norton Utilities Advanced Edition ©1987-1989 by Peter Norton. ;Note some of the Norton Utilities not included here will lock up your computer ;if run from within Windows. a=Version() CP="CmdPost" ; Lines below good only for licensed versions. TitleFirst="The Norton Utilities® from Windows!" TitleRest= "The Norton Utilities® from Windows!" b=strsub(";",1,IsLicensed()) execute %b% TitleFirst="The Norton Utilities® from Windows! - Eval Only" execute %b% TitleRest ="The Norton Utilities® from Windows! # Eval Only" crlf=strcat(num2char(13),num2char(10)) tab=num2char(9) ; Setting up the View menu item here. ViewShortLong=iniread(CP,"ViewShortLong","SHORT") MenuChange("ViewShort", (ViewShortLong=="SHORT")*@CHECK) MenuChange("ViewLong", (ViewShortLong=="LONG")*@CHECK) ViewBy=iniread(CP,"ViewBy","NAME") MenuChange("ViewByName", (ViewBy=="NAME")*@CHECK) MenuChange("ViewByDate", (ViewBy=="DATE")*@CHECK) MenuChange("ViewBySize", (ViewBy=="SIZE")*@CHECK) MenuChange("ViewByKind", (ViewBy=="KIND")*@CHECK) MenuChange("ViewUnsorted",(ViewBy=="UNSORTED")*@CHECK) ViewWhat=iniread(CP,"ViewWhat","ALL") MenuChange("ViewAll", (ViewWhat=="ALL") *@CHECK) MenuChange("ViewPartial", (ViewWhat=="PARTIAL") *@CHECK) MenuChange("ViewPrograms", (ViewWhat=="PROGRAMS")*@CHECK) a=iniread(CP,"Partial","*.*") SD3=strcat(strsub("*.*",1,IsMenuChecked("ViewAll")*3),strsub(a,1,IsMenuChecked("ViewPartial")*strlen(a)),strsub("*.EXE *.COM *.BAT *.PIF",1,IsMenuChecked("ViewPrograms")*23)) SetDisplay(ViewShortLong,ViewBy,SD3) drop(a,ViewShortLong,ViewBy,ViewWhat,SD3) ; Setup Print menu item...Kill it if no text printer MenuChange("FilePrint", (IniRead(CP,"TextPrinter","")=="NONE") *@DISABLE) TitleTemp=TitleRest WinTitle("",TitleTemp);Title of this 'Post ;Do not Drop TitleFirst,TitleRest,crlf,tab,CP as these are used ;in following menu items. Drop(a,TitleTemp,IfOnlyMe) ; And the menu starts. Notice that we are emulating the MS-DOS Window &File &Run... r=CurrentFile() a=strsub(";",1,IsKeyDown(@SHIFT)) execute %a% r=askline("RUN","Enter file to run",r) r=strcat(strtrim(r)," ") i=strindex(r," ",0,@FWDSCAN) run(strsub(r,1,i-1),strtrim(strsub(r,i,strlen(r)-i+1))) drop(a,r,i) &Load... r=CurrentFile() a=strsub(";",1,IsKeyDown(@SHIFT)) execute %a% l=askline("LOAD","Enter file to load",CurrentFile()) l=strcat(strtrim(l)," ") i=strindex(l," ",0,@FWDSCAN) runicon(strsub(l,1,i-1),strtrim(strsub(l,i,strlen(l)-i+1))) drop(a,i,l) Bro&wse... l=CurrentFile() a=strsub(";",1,IsKeyDown(@SHIFT)) execute %a% l=askline("Browse","Enter file to browse",l) run("browser.exe",l) drop(a,l) &Notepad Edit... l=CurrentFile() a=strsub(";",1,IsKeyDown(@SHIFT)) execute %a% l=askline("Notepad Edit","Enter file to edit",l) run("notepad.exe",l) drop(a,l) &Copy... r=OtherDir() a=strsub(";",1,IsKeyDown(@SHIFT)) s=strcat(DirItemize("")," ",FileItemize("")) terminate(strlen(s)==1,"Copy Error","No files selected") execute %a% r=askline("Copy",StrCat(s,crlf,crlf,"to"),r) terminate(r=="","Copy Error","Cannot copy to null file name") FileCopy(s,r,@TRUE) OtherUpdate() q=strindex(r,"\",0,@FWDSCAN) ; Directory Name in there?? q=strsub(";",1,q!=0) execute %q% SetDisplay("","","") drop(a,r,s,q) &Move... r=OtherDir() a=strsub(";",1,IsKeyDown(@SHIFT)) s=strcat(DirItemize("")," ",FileItemize("")) terminate(strlen(s)==1,"Move Error","No files selected") execute %a% r=askline("Move",StrCat(s,crlf,crlf,"to"),r) terminate(r=="","Move Error","Cannot move to null file name") FileMove(s,r,@TRUE) SetDisplay("","","") OtherUpdate() drop(a,r,s) &Rename... s=FileItemize("") terminate(s=="","Rename Error","No files selected") r=askline("Rename",StrCat(s,crlf,crlf,"to"),s) terminate(r=="","Rename Error","Cannot rename to """"") FileMove(s,r,@TRUE) SetDisplay("","","") OtherUpdate() drop(a,r,s) &Delete File.. f=FileItemize("") g=DirItemize("") c=strsub( ";", 1, (strlen(g)==0) ) b=0 execute %c% b=AskYesNo("!!! Warning !!! ",strcat("Delete files from these directories too?",crlf,g)) c=strsub(";",1,abs(b-1)) execute %c% f=strcat(g," ",f) terminate(strlen(f)==0,"delete","No files specified") terminate(askyesno("Delete",f)==0,"Delete","File(s) not deleted") FileDelete(f) SetDisplay("","","") OtherUpdate() ; Well if the "other" CmdPost Window points to the ; same directory, it *IS* nice... drop(f,g,a) &Print... s=FileItemize("") terminate(strlen(s)==0,"Print Error","No files selected") TextPrinter=iniread(CP,"TextPrinter","ASK") a=strsub(";",1,TextPrinter!="ASK") b=";" Execute %a% r=AskYesNo("Attention",strcat("This print routine only works with standard printers.",crlf,"Do you have a standard (NON-Postscript) printer?")) Execute %a% b=strsub(";",1,r==@YES) Execute %b% iniwrite(CP,"TextPrinter","NONE") Execute %b% MenuChange("FilePrint",@DISABLE) Execute %b% Exit Execute %a% TextPrinter="NONE|LPT1|LPT2|LPT3" Execute %a% TextPrinter=ItemSelect("Choose the STD text printer",TextPrinter,"|") Execute %a% terminate(strlen(TextPrinter)==0,"Error","Nothing chosen") Execute %a% iniwrite(CP,"TextPrinter",TextPrinter) Terminate(TextPrinter=="NONE","ERROR","No Text Printers on system") a=AskLine("Print",strcat(s,crlf,crlf,"to"),TextPrinter) FileCopy(s,a,@FALSE) _&Size of selected files message("Total size of files",strcat(FileSize(FileItemize(""))," Bytes")) &Freespace on Drives ; This code initially asks for your last drive ; (It does assume you have no holes between C and the ; last drive...) ; and then computes disk space based on the last drive NextDrive="C" crlf=strcat(num2char(13),num2char(10)) LastDrive=iniread("CmdPost","LastDrive","ASK") xxx=strsub(";",1,(LastDrive!="ASK")) execute %xxx% LastDrive=AskLine("Setup Question",strcat("Enter letter of last (contiguous) disk drive",crlf,"C D E F G H ...Z"),"C") execute %xxx% LastDrive=StrUpper(LastDrive) execute %xxx% iniwrite("CmdPost","LastDrive",LastDrive) ; Always do C drive a=DiskFree(NextDrive)/1024 TotalSize=a DriveReport=strcat(NextDrive," = ",a,"K") NextDrive=num2char(char2num(NextDrive)+1) xxx=strsub(";",1,NextDrive>LastDrive) ; Check on D drive execute %xxx% a=DiskFree(NextDrive)/1024 execute %xxx% TotalSize=TotalSize+a execute %xxx% DriveReport=strcat(DriveReport,crlf,NextDrive," = ",a,"K") execute %xxx% NextDrive=num2char(char2num(NextDrive)+1) execute %xxx% xxx=strsub(";",1,NextDrive>LastDrive) ; Check on E drive execute %xxx% a=DiskFree(NextDrive)/1024 execute %xxx% TotalSize=TotalSize+a execute %xxx% DriveReport=strcat(DriveReport,crlf,NextDrive," = ",a,"K") execute %xxx% NextDrive=num2char(char2num(NextDrive)+1) execute %xxx% xxx=strsub(";",1,NextDrive>LastDrive) ; Check on F drive execute %xxx% a=DiskFree(NextDrive)/1024 execute %xxx% TotalSize=TotalSize+a execute %xxx% DriveReport=strcat(DriveReport,crlf,NextDrive," = ",a,"K") execute %xxx% NextDrive=num2char(char2num(NextDrive)+1) execute %xxx% xxx=strsub(";",1,NextDrive>LastDrive) ; Check on G drive execute %xxx% a=DiskFree(NextDrive)/1024 execute %xxx% TotalSize=TotalSize+a execute %xxx% DriveReport=strcat(DriveReport,crlf,NextDrive," = ",a,"K") execute %xxx% NextDrive=num2char(char2num(NextDrive)+1) execute %xxx% xxx=strsub(";",1,NextDrive>LastDrive) ; Check on H drive execute %xxx% a=DiskFree(NextDrive)/1024 execute %xxx% TotalSize=TotalSize+a execute %xxx% DriveReport=strcat(DriveReport,crlf,NextDrive," = ",a,"K") execute %xxx% NextDrive=num2char(char2num(NextDrive)+1) execute %xxx% xxx=strsub(";",1,NextDrive>LastDrive) ; Check on I drive execute %xxx% a=DiskFree(NextDrive)/1024 execute %xxx% TotalSize=TotalSize+a execute %xxx% DriveReport=strcat(DriveReport,crlf,NextDrive," = ",a,"K") execute %xxx% NextDrive=num2char(char2num(NextDrive)+1) execute %xxx% xxx=strsub(";",1,NextDrive>LastDrive) ; Well if you have more than I drives, just repeat the ; Code blocks above Message("Total Space = %TotalSize%K",DriveReport) Drop(xxx,TotalSize,DriveReport,NextDrive,LastDrive) Space on &A and size of files message(strcat("Drive A ",DiskFree("A")),strcat("Selected Files ",FileSize(FileItemize("")))) Space on &B and size of files message(strcat("Drive B ",DiskFree("B")),strcat("Selected Files ",FileSize(FileItemize("")))) &Dir C&reate Directory... a=askline("Create Directory","Enter directory to create","") terminate(a=="","Create Error","Cannot create directory with null name") DirMake(a) SetDisplay("","","") drop(a) &Delete Directory... f=DirItemize("") terminate(strlen(f)==0,"Delete Directory","No directory specified") terminate(@no==askyesno("Delete Directory",f),"Delete Directory","Directory not deleted") DirRemove(f) SetDisplay("","","") OtherUpdate() ; Well if the "other" CmdPost Window points to the ; same directory, it *is* nice drop(f) &Change Directory... a=DirGet() b=strindex(a,':',1,@fwdscan) c=askline("Change Directory","Enter directory name",strsub(a,b+1,strlen(a)-b-1)) terminate(c=="","Directory Error","Directory with null name does not exist") DirChange(c) SetDisplay("","","") drop(a,b,c) _&Format Diskette... ; A wonderful example of variable substitution D1="1) 5.25 High Density (1.2M)" D2="2) 5.25 Standard (360K)" D3="3) 3.5 High Density (1.44M)" D4="4) 3.5 Standard (720K)" D0="0) None" DC="%D1%|%D2%|%D3%|%D4%|%D0%" DriveA=iniread(CP,"DriveA","ASK") xxx=strsub(";",1,DriveA!="ASK") execute %xxx% Message("Attention","Command Post needs to learn what kind of floppies %crlf% the system has. Please select accordingly.") execute %xxx% a=ItemSelect("Select type of Drive A",DC,"|") execute %xxx% Terminate(a=="","You MUST select an option for A.","Please retry FORMAT command.") execute %xxx% DriveA=strsub(a,1,1) execute %xxx% iniwrite(CP,"DriveA",DriveA) DriveB=iniread(CP,"DriveB","ASK") xxx=strsub(";",1,DriveB!="ASK") execute %xxx% a=ItemSelect("Select type of Drive B",DC,"|") execute %xxx% Terminate(a=="","You MUST select an option for B.","Please retry FORMAT command.") execute %xxx% DriveB=strsub(a,1,1) execute %xxx% iniwrite(CP,"DriveB",DriveB) A0="" A1="1) A: 5.25 HD (1.2M)|2) A: 5.25 DD (360K)" A2="2) A: 5.25 DD (360K)" A3="3) A: 3.5 HD (1.44M)|4) A: 3.5 Std (720K)" A4="4) A: 3.5 Standard (720K)" B0="" B1="5) B: 5.25 HD (1.2M)|6) B: 5.25 DD (360K)" B2="6) B: 5.25 Standard (360K)" B3="7) B: 3.5 HD (1.44M)|8) B: 3.5 DD (720K)" B4="8) B: 3.5 DD (720K)" FF=strcat(A%DriveA%,"|",B%DriveB%) drop(A0,A1,A2,A3,A4,B0,B1,B2,B3,B4) FF=ItemSelect("Choose Format Type Desired",FF,"|") terminate(FF=="","Format","No parameters selected") FF=strsub(FF,1,1) ; FF will be 1 thru 8 (with luck) DR=strsub("AB",(FF>4)+1,1) ; DR is desired drive FF=FF-((FF>4)*4) ; FF is 1 thru 4 F11="" F12="/4" F22="" F33="" F34="/n:9 /t:80" F44="" DC=Drive%DR% ; get drive type FC=F%DC%%FF% FC="%DR%: %FC%" DC=strsub(D%FF%,4,strlen(d%FF%)-3) Pause("Attention",strcat("Preparing to format %DC%",crlf,"diskette in Drive %DR% with command:",crlf,"FORMAT %FC%")) run("command.com","/c format.com %FC%") drop(D0,D1,D2,D3,D4,DC,xxx,DriveA,DriveB) drop(FF,DR,F11,F12,F22,F33,F34,F44,DC,FC) _Directory &Tree run("cp_tree.exe","") &View &Short SetDisplay("SHORT","","") MenuChange("ViewShort",@CHECK) MenuChange("ViewLong",@UNCHECK) iniwrite(CP,"ViewShortLong","SHORT") &Long SetDisplay("LONG","","") MenuChange("ViewShort",@UNCHECK) MenuChange("ViewLong",@CHECK) iniwrite(CP,"ViewShortLong","LONG") _&All SetDisplay("","","*.*") MenuChange("ViewAll",@CHECK) MenuChange("ViewPartial",@UNCHECK) MenuChange("ViewPrograms",@UNCHECK) iniwrite(CP,"ViewWhat","ALL") &Partial... a=iniread(CP,"Partial","*.*") a=AskLine("View Partial","Enter types of files desired",a) iniwrite(CP,"Partial",a) SetDisplay("","",a) MenuChange("ViewAll",@UNCHECK) MenuChange("ViewPartial",@CHECK) MenuChange("ViewPrograms",@UNCHECK) iniwrite(CP,"ViewWhat","PARTIAL") P&rograms SetDisplay("","","*.EXE *.COM *.BAT *.PIF") MenuChange("ViewAll",@UNCHECK) MenuChange("ViewPartial",@UNCHECK) MenuChange("ViewPrograms",@CHECK) iniwrite(CP,"ViewWhat","PROGRAMS") _By &Name SetDisplay("","NAME","") MenuChange("ViewByName",@CHECK) MenuChange("ViewByDate",@UNCHECK) MenuChange("ViewBySize",@UNCHECK) MenuChange("ViewByKind",@UNCHECK) MenuChange("ViewUnsorted",@UNCHECK) iniwrite(CP,"ViewBy","NAME") By &Date SetDisplay("","DATE","") MenuChange("ViewByName",@UNCHECK) MenuChange("ViewByDate",@CHECK) MenuChange("ViewBySize",@UNCHECK) MenuChange("ViewByKind",@UNCHECK) MenuChange("ViewUnsorted",@UNCHECK) iniwrite(CP,"ViewBy","DATE") By Si&ze SetDisplay("","SIZE","") MenuChange("ViewByName",@UNCHECK) MenuChange("ViewByDate",@UNCHECK) MenuChange("ViewBySize",@CHECK) MenuChange("ViewByKind",@UNCHECK) MenuChange("ViewUnsorted",@UNCHECK) iniwrite(CP,"ViewBy","SIZE") By &Kind SetDisplay("","KIND","") MenuChange("ViewByName",@UNCHECK) MenuChange("ViewByDate",@UNCHECK) MenuChange("ViewBySize",@UNCHECK) MenuChange("ViewByKind",@CHECK) MenuChange("ViewUnsorted",@UNCHECK) iniwrite(CP,"ViewBy","KIND") &Unsorted SetDisplay("","UNSORTED","") MenuChange("ViewByName",@UNCHECK) MenuChange("ViewByDate",@UNCHECK) MenuChange("ViewBySize",@UNCHECK) MenuChange("ViewByKind",@UNCHECK) MenuChange("ViewUnsorted",@CHECK) iniwrite(CP,"ViewBy","UNSORTED") ;************************ NORTON UTILITIES MENU... *********************** &Norton Utilities &Find Files Title = "Find a File" TheFile = askline (Title, "Filename to Find:", FileItemize("")) fAll = AskYesNo (Title, "Search all drives?") All = strsub(" /A", fAll*2+1, 2) Run ("FF.EXE", "%TheFile% %All%") &Search for Text Title = "Find Text in Files" TheFile = strcat (FileItemize (""), " ") TheFile = strsub (TheFile, 1, strindex(TheFile, " ", 1, @FWDSCAN)-1) IfNot = strsub ("; ", (TheFile=="")+1, 1) execute %IfNot% TheFile = AskLine (Title, "Files to search:", "*.*") Text = AskLine (Title, "Text to search for:", "") Run ("TS.EXE", "%TheFile% ""%Text%"" /T") Files with &Attributes Title = "List Files with Attributes" Attribs = "Archive,Hidden,Read Only,System,[All of the above]" TheAt = ItemSelect ("List files with which attributes?", Attribs, ",") terminate (TheAt=="", Title, "No attributes selected.") TheAt = strsub(TheAt, 1, 1) AtTemplate = "[U AA HHIDRR SSYS " Attrib = strsub (AtTemplate, strscan (AtTemplate, TheAt, 1, @FWDSCAN)+1, 3) Run ("FA.EXE", "/%Attrib%") Delete && &Wipe Files Title = "Delete & Wipe Files" TheFiles = FileItemize ("") IfNot = strsub("; ",1+(TheFiles==""),1) execute %IfNot% TheFiles = AskLine (Title, "Files to delete", "") Terminate (TheFiles=="", Title, "No files selected") Run ("Wipefile.EXE", "%TheFiles% /P") Disk &Info for This Drive Run ("DI.EXE", "") Compute &SI Index Run ("SI.EXE", "/N") _Reset && Start Timer Title = "Start Timer" RunHide ("TM.EXE", "START") Yield WinClose ("(Inactive Norton Time Mark)") Display (2, Title, "Timer is running.") Time Since Last "Start" RunZoom ("TM.EXE", "STOP")