home *** CD-ROM | disk | FTP | other *** search
- ; Define addon menu USER menus should go into CMDUSER.CPM...by convention...
-
- #NextFile CMDUSER.CPM
-
- ; CmdPost menu initialization code
-
- ; Initialize a few variables here. You may dink the CP names below
- ; Just keep the two names different.
-
- a=Version()
- CP="CmdPost"
-
- ; Lines below good only for licensed versions.
-
- TitleFirst="[Omega]" ; Name of your primary CP Window
- TitleRest= "<Omega>" ; Name of your other CP Windows
- b=strsub(";",1,IsLicensed())
- execute %b% TitleFirst="Command Post %a% - Eval Only"
- execute %b% TitleRest ="Command Post %a% # 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)
-
- ; Setup Screen Blank Time. Get time from win.ini
-
- run("cp_blnk.exe",iniread(CP,"BlankTime",5))
- ; <0....blanking with no clock
- ; 0... no blanking, but have a clock
- ; >0... blanking and clock
- ; multiple startups ignored.
-
- ; This obscure code just names the two Command Post windows.
- ; This code also is depended upon by the Main.CommandPost item below
-
- IfOnlyMe=strsub(";",1,IsRunning()==@TRUE) ;Funny reverse logic...
-
- ErrorMode(@OFF)
- Execute %IfOnlyMe% WinTitle("",TitleFirst);Title of first 'Post
- Execute %IfOnlyMe% WinPlace(0,0,1000,@ABOVEICONS,"")
- Execute %IfOnlyMe% Exit
-
- TitleTemp=TitleRest
- a=WinActivate(TitleFirst)
- a=strsub(";",1,a)
- Execute %a% TitleTemp=TitleFirst
- WinTitle("",TitleTemp);Title of this 'Post
- WinPlace(0,0,500,@ABOVEICONS,TitleFirst)
- WinPlace(500,0,1000,@ABOVEICONS,TitleRest)
- ErrorMode(@CANCEL)
-
- ;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=FileItemize("")
- r=strcat(strtrim(r)," ")
- i=strindex(r," ",0,@FWDSCAN)
- r=strsub(r,1,i-1)
- 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...
- l=FileItemize("")
- l=strcat(strtrim(l)," ")
- i=strindex(l," ",0,@FWDSCAN)
- l=strsub(l,1,i-1)
- a=strsub(";",1,IsKeyDown(@SHIFT))
- execute %a% l=askline("Load","Enter file to load",l)
- 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)
-
- &Copy...
- r=OtherDir()
- a=strsub(";",1,IsKeyDown(@SHIFT))
- s=strcat(DirItemize("")," ",FileItemize(""))
- IfNoFiles=(strsub(";",1,strlen(s)>1))
- execute %IfNoFiles% s=askline("Copy","Enter file(s) to copy","")
- execute %IfNoFiles% s=strcat(strtrim(s)," ")
- drop(IfNoFiles)
- 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(""))
- IfNoFiles=(strsub(";",1,strlen(s)>1))
- execute %IfNoFiles% s=askline("Move","Enter file(s) to move","")
- execute %IfNoFiles% s=strcat(strtrim(s)," ")
- drop(IfNoFiles)
- 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)
-
- &Delete...
- 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)
- IfNoFiles=(strsub(";",1,strlen(f)>0))
- execute %IfNoFiles% f=askline("Delete","Enter file(s) to delete","")
- drop(IfNoFiles)
- 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("")
- IfNoFiles=(strsub(";",1,strlen(s)>0))
- execute %IfNoFiles% s=askline("Print","Enter file(s) to print","")
- execute %IfNoFiles% s=strcat(strtrim(s)," ")
- drop(IfNoFiles)
- terminate(strlen(s)==0,"Print Error","No files selected")
- Printer=iniread("Windows","device","")
- i=StrIndex(Printer,",",1,@FWDSCAN)
- PrinterName=StrSub(Printer,1,I-1)
- i=StrIndex(Printer,",",StrLen(Printer),@BACKSCAN)
- Port=StrSub(Printer,I+1,(StrLen(Printer)-(I+1)))
- IfPostScript=strsub(";",1,StriCmp(PrinterName,"PostScript Printer")<>0)
- q=strcat(s,CRLF,CRLF,"Using ",PrinterName," on ",Port)
- terminate(askyesno("Print",q)==0,"","")
- Execute %IfPostScript% run("command.com",strcat("/c POST L 15 T 756 B 36 <",s," >",Port))
- Execute %IfPostScript% drop(q,s,i,IfPostScript,Printer,PrinterName,Port)
- Execute %IfPostScript% exit
- FileCopy(s,Port,@FALSE)
- drop(q,s,i,IfPostScript,Printer,PrinterName,Port)
-
- Re&name...
- r=CurrentFile()
- a=strsub(";",1,IsKeyDown(@SHIFT))
- s=strcat(DirItemize("")," ",FileItemize(""))
- IfNoFiles=(strsub(";",1,strlen(s)>1))
- execute %IfNoFiles% s=askline("Rename","Enter file(s) to rename","")
- execute %IfNoFiles% s=strcat(strtrim(s)," ")
- drop(IfNoFiles)
- terminate(strlen(s)==1,"Rename Error","No files selected")
- execute %a% r=askline("Rename",StrCat(s,crlf,crlf,"to"),r)
- terminate(r=="","Rename Error","Cannot rename to null file name")
- FileRename(s,r)
- SetDisplay("","","")
- OtherUpdate()
- drop(a,r,s)
-
- Bro&wse...
- l=CurrentFile()
- a=strsub(";",1,IsKeyDown(@SHIFT))
- execute %a% l=askline("Browse","Enter file to browse",l)
- RunZoom("browser.exe",l)
- drop(a,l)
-
- _&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)
-
- ; Well if you have more than G 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(""))))
-
- _&Extensions...
- a=strtrim(CurrentFile())
- i=strindex(a,".",0,@FWDSCAN)
- terminate(i==0,"Association Error","Associated files must have an extension")
- b=strsub(a,i+1,strlen(a)-i)
- c=iniread("extensions",b,"???.EXE ^.%b%")
- d=askline("Associate","%b% files are associated with",c)
- terminate(c==d,"","")
- iniwrite("extensions",b,d)
-
- _Cl&ose Second CmdPost Window
- Terminate(StrIndex(WinItemize(),TitleRest,1,@FWDSCAN)==0,"Error","No Second Cmdpost Window")
- WinActivate(TitleFirst)
- WinClose(TitleRest)
- WinPlace(0,0,1000,@ABOVEICONS,TitleFirst)
-
- Make CmdPost Window Ori&ginal Size
- WinPlace(0,0,1000,@ABOVEICONS,TitleFirst)
-
- E&xit Windows
- EndSession()
-
- &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("")
- IfNoFiles=(strsub(";",1,strlen(f)>0))
- execute %IfNoFiles% s=askline("Delete Directory","Enter directory to delete","")
- execute %IfNoFiles% s=strcat(strtrim(s)," ")
- drop(IfNoFiles)
- 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)
-
- _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")
-
- |&1 Stack
- winarrange(1)
-
- &2 Arrange
- winarrange(2)
-
- &3 Arrange in Rows
- winarrange(3)
-
- &4 Arrange in Columns
- winarrange(4)
-
- _&5 (w/o CP) Stack
- winiconize("")
- winarrange(1)
-
- &6 (w/o CP) Arrange
- winiconize("")
- winarrange(2)
-
- &7 (w/o CP) Arrange in Rows
- winiconize("")
- winarrange(3)
-
- &8 (w/o CP) Arrange in Cols
- winiconize("")
- winarrange(4)
-
- &Main
- &Command Post
- a=strcat("abcdefghijk",WinGetActive())
- b=strlen(a)
- c=strsub(a,b-9,10)!="Unlicensed"
- c=strsub(";",1,c)
- Execute %c% run("cmdpost.exe","")
- Execute %c% Exit
- ErrorMode(@OFF)
- a=WinActivate(TitleFirst)
- b=WinActivate(TitleRest)
- ErrorMode(@CANCEL)
- c=strsub(";",1, a&b )
- Execute %c% run("cmdpost.exe","")
- Execute %c% Exit
- WinPlace(0,0,500,@ABOVEICONS,TitleFirst)
- WinPlace(500,0,1000,@ABOVEICONS,TitleRest)
- drop(a,b,c)
-
- Control &Panel
- errormode(@off)
- winactivate("Control Panel")
- terminate(LastError()==0,"","")
- errormode(@cancel)
- run("control.exe","")
-
- C&lipboard
- errormode(@off)
- terminate(winactivate("Clipboard"),"","") ;Already Running
- errormode(@cancel)
- run("clipbrd.exe","")
-
- &DOS Prompt
- run("command.com","")
-
- _Get &Help Cardfile
- run("cardfile.exe","cp_help.crd")
-
- Reset &Options...
- a=iniread(CP,"BlankTime",5)
- b1="Enter screen blanker delay time"
- b2="or 0 to disable blanker"
- b3="or negative time to disable clock"
- b1=strcat(b1,crlf,b2,crlf,b3)
- a=AskLine("Screen Blanker",b1,iniread(CP,"BlankTime",5))
- iniwrite(CP,"BlankTime",a)
- ErrorMode(@OFF)
- WinClose("CmdPost Clock")
- ErrorMode(@CANCEL)
- run("CP_BLNK.EXE",a)
- b1="Do you wish to reset CmdPost's Printer"
- b2="and Disk Drive information?"
- b1=strcat(b1,crlf,b2)
- a=AskYesNo("Information Reset",b1)
- a=strsub(";",1,a==@NO)
- execute %a% iniwrite(CP,"TextPrinter","ASK")
- execute %a% iniwrite(CP,"LastDrive","ASK")
- execute %a% iniwrite(CP,"DriveA","ASK")
- execute %a% iniwrite(CP,"DriveB","ASK")
- execute %a% MenuChange("FilePrint",@ENABLE)
- b1="CmdPost's saved information reset."
- b2="You will be prompted to re-enter the"
- b3="necessary information when it is required."
- b1=strcat(b1,crlf,b2,crlf,b3)
- execute %a% Message("Information Reset",b1)
- drop(a,b1,b2,b3)
-
- _&System Information
- run("cp_info.exe","")
-
- |P&rogram Manager
- errormode(@off)
- terminate(winactivate("Program Manager"),"","") ;Already Running
- errormode(@cancel)
- run("Progman.exe","")
-
- &File Manager
- errormode(@off)
- terminate(winactivate("File Manager"),"","") ;Already Running
- errormode(@cancel)
- run("winfile.exe","")
-
- Print &Manager
- run("printman.exe","") ; takes care of itself
-
- &Windows Setup
- a=Filelocate("system.ini")
- b=strindex(a,"\",0,@BACKSCAN)
- a=strsub(a,1,b)
- run(strcat(strsub(a,1,b),"setup.exe"),"")
-
- _&Edit CmdPost menus
- a=FileLocate("CMDPOST.CPM")
- b=strindex(a,"\",0,@BACKSCAN)
- DirChange(strsub(a,1,b))
- a=FileItemize("*.CPM")
- a=ItemSelect("Select menu to edit",a," ")
- terminate(a=="","Edit","No file selected")
- ;it it already running??? Find it...
- ErrorMode(@OFF)
- terminate(WinActivate("Notepad - %a%"),"","") ;Already being edited
- dot=strindex(a,".",0,@FWDSCAN)
- bak=strcat(strsub(a,1,dot),"BAK")
- FileCopy(a,bak,@FALSE)
- RunZoom("notepad.exe",a)
-
- Edit &INI files
- a=FileLocate("WIN.INI")
- b=strindex(a,"\",0,@BACKSCAN)
- DirChange(strsub(a,1,b))
- NotWin2 = strsub(";",1,(WinVersion(@MAJOR)==2))
- a="WIN.INI"
- execute %NotWin2% a=FileItemize("*.INI")
- execute %NotWin2% a=ItemSelect("Select INI file to edit",a," ")
- execute %NotWin2% terminate(a=="","Edit","No file selected")
- drop(NotWin2,b)
- ;it it already running??? Find it...
- ErrorMode(@OFF)
- terminate(WinActivate("Notepad - %a%"),"","") ;Already being edited
- dot=strindex(a,".",0,@FWDSCAN)
- bak=strcat( strsub(a,1,dot),"BAK")
- FileCopy(a,bak,@FALSE);
- RunZoom("notepad.exe",a)
- drop(a,dot,bak)
-
- Edit System Confi&guration
- run("sysedit.exe","") ;takes care of itself
-