home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / batch / mxmnu233.zip / QUICKNOV.MNU < prev    next >
Text File  |  1991-09-30  |  14KB  |  669 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Copyright 1990-91 by Marc Perkel * All right reserved.
  5.  
  6. This menu is a sample of a Novell ready menu. You can easilly modify it
  7. to suit your needs.
  8.  
  9. To add a choice to a menu simply use the AddChoice command
  10. then add the appropiate Onkey statement.
  11. The menu will make the size adjustments accordinaly.
  12.  
  13.   Example:
  14.       AddChoice("Print Console",10)
  15.       ...
  16.       ...
  17.       OnKey Task(10)
  18.         PConsole
  19.       ...
  20.  
  21. If you want to change the menu's center, pass the XY
  22. coordinates to menu's CenterStretchBox procedure.
  23.  
  24.    Example:
  25.       CenterStretchBox("Menu Header",10,10)
  26.  
  27. This will cause the menu to center at Col 10, Row 10
  28.  
  29. To control custom features, edit CUSTOM.INC and other INCLUDE Files.
  30.  
  31. =========================================================
  32. EndComment
  33.  
  34. ;------ Create Variables
  35.  
  36. Var
  37.   PrintQueueChoices
  38.   PortChoices
  39.   MyServer
  40.   AllUsers
  41.   NetAddress
  42.   Station
  43.   UserName
  44.   BMess
  45.   TitleBackColor
  46.   TitleInsideColor
  47.   PersonalMenu
  48.   FilePicked
  49.  
  50.  
  51. MyServer = NovDefaultServer
  52. Station  = Str(NovConnection)
  53. UserName = NovMyLoginName
  54.  
  55. ;------ Read network address
  56.  
  57. NetAddress = NovStationAddress (NovConnection)
  58.  
  59. ;------ Personalize Your Screen Messages
  60.  
  61. StatusLineText = 'User: ' + UserName + '  *  Server: ' + MyServer
  62. StatusLineText = StatusLineText + '  *  Address: ' + NetAddress
  63. if length(StatusLineText) < 64
  64.    StatusLineText = StatusLineText + '  *  Dos: ' + DosVersionString
  65. endif
  66.  
  67. MenuTitle = 'Computer Tyme Master Menu'
  68.  
  69. Comment
  70. ==========================================================
  71.  
  72. If you want to branch to a personal menu then this routine test for the
  73. existence of a menu in the users H: directory with the same name as the
  74. users login name. It then sets an environment variable indicating if it
  75. was found. This keeps the menu fast because the test need only be made
  76. once.
  77.  
  78. ==========================================================
  79. EndComment
  80.  
  81. ;------ Set Personal Menu in Environment Variable if menu exists
  82.  
  83. PersonalMenu = ReadEnv('PMENU')
  84. if PersonalMenu = ''
  85.    PersonalMenu = 'H:' + NovMyLoginName + '.MNU'    ;Z: is my home directory
  86.    if not ExistFile (PersonalMenu)
  87.       PersonalMenu = 'NONE'
  88.    endif
  89.    SetEnv('PMENU=' + PersonalMenu)
  90. endif
  91.  
  92. ;------ Load menu look and feel include files
  93.  
  94. Include 'CUSTOM.INC'
  95.  
  96. Comment
  97. ==========================================================
  98.  
  99. I have defined a procedure called CenterStretchBox which takes as
  100. parameters a menu title, array of choices, and the XY coordinants
  101. of the center of the window. CenterStretchBox then displays all the
  102. choices and numbers them. This method allows me to update the menu
  103. more quickly.
  104.  
  105. ==========================================================
  106. EndComment
  107.  
  108. AppendArray(PortChoices,'Lpt1')
  109. AppendArray(PortChoices,'Lpt2')
  110. AppendArray(PortChoices,'Lpt3')
  111.  
  112. Comment
  113. =================================
  114.  
  115. In order to add menu choices conditionally you would append the
  116. choices to the end of the array after all the default choices
  117. are set. For Example:
  118.  
  119.    if NovInGroup("ACCOUNTING")
  120.       AddChoice("Payroll Menu",10)
  121.    endif
  122.  
  123. Here is where menus are created.
  124.  
  125. =================================
  126. EndComment
  127.  
  128. ;----- Main Menu
  129.  
  130. AddChoice('Accounting',1)
  131. AddChoice('Word Processing',2)
  132. AddChoice('SpreadSheet',3)
  133. AddChoice('DataBase',4)
  134. AddChoice('Graphics',5)
  135. AddChoice('Communication',6)
  136. AddChoice('Publishing',7)
  137. AddChoice('Utilities',20)
  138. if PersonalMenu <> 'NONE' then AddChoice('Personal Menu',25)
  139.  
  140. CornerStretchBox ('Main Menu',11,6)
  141.  
  142. OnKey Task(1)
  143.    |Error('Put Code for Accounting here.')
  144.  
  145. OnKey Task(2)
  146.    |Error('Put Code for Word Processing here.')
  147.  
  148. OnKey Task(3)
  149.    |Error('Put Code for SpreadSheet here.')
  150.  
  151. OnKey Task(4)
  152.    |Error('Put Code for DataBase here.')
  153.  
  154. OnKey Task(5)
  155.    |Error('Put Code for Graphics here.')
  156.  
  157. OnKey Task(6)
  158.    |Error('Put Code for Communication here.')
  159.  
  160. OnKey Task(7)
  161.    |Error('Put Code for Publishing here.')
  162.  
  163. OnKey Task(20)
  164.    ^Util
  165.  
  166. OnKey Task(25)
  167.    |Bat 'Marx ' + PersonalMenu
  168.  
  169. OnKey ESC
  170.    |if NovConsoleOperator  ;keeps users in menu
  171.    |   LeaveMenu
  172.    |endif
  173.  
  174. ;----- Util Menu
  175.  
  176. :Util
  177.  
  178. AddChoice('Printer Select',1)
  179. AddChoice('Format Disk Menu',2)
  180. AddChoice('Dos Functions',3)
  181. AddChoice('Novell Information',4)
  182. AddChoice('Novell User Options',5)
  183. if NovConsoleOperator
  184.    AddChoice('Novell Utilities',6)
  185.    AddChoice('Maintainence',7)
  186.    AddChoice('Menu Utilities',8)
  187.    AddChoice('Command Line',9)
  188. endif
  189.  
  190. CornerStretchBox ('Utility Menu',43,6)
  191.  
  192. OnKey Task(1)
  193.   |SelectPrintQueue
  194.   |Dispose Choices
  195.   |LastKey = ' '
  196.  
  197. OnKey Task(2)
  198.   |SelectFormat
  199.   |LastKey = ' '
  200.  
  201. OnKey Task(3)
  202.   ^Dos
  203.  
  204. OnKey Task(4)
  205.   ^NovInfo
  206.  
  207. OnKey Task(5)
  208.   ^NovUser
  209.  
  210. OnKey Task(6)
  211.   ^NovUtils
  212.  
  213. OnKey Task(7)
  214.   ^Maint
  215.  
  216. OnKey Task(8)
  217.   ^MenuUtil
  218.  
  219. OnKey Task(9)
  220.   |if ExistOnPath('DOLIST.EXE') > ''
  221.      DropTo DoList
  222.   |else
  223.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  224.   |endif
  225.  
  226. ;----- Dos Menu
  227.  
  228. :Dos
  229.  
  230. AddChoice('Directory Master',1)
  231. AddChoice('Pick Directory',2)
  232. AddChoice('Show Directory',3)
  233. AddChoice('Free Space',4)
  234. AddChoice('Memory Map',5)
  235. AddChoice('Device Drivers',6)
  236.  
  237. CenterStretchBox ('DOS Menu',38,15)
  238.  
  239. OnKey Task(1)
  240.   |if NovConsoleOperator
  241.      DropTo DM3
  242.   |else
  243.      DropTo DMLITE
  244.   |endif
  245.  
  246. OnKey Task(2)
  247.    PD
  248.  
  249. OnKey Task(3)
  250.    D/W
  251.  
  252. OnKey Task(4)
  253.    Free
  254.    Pause
  255.  
  256. OnKey Task(5)
  257.    RamMap
  258.    Pause
  259.  
  260. OnKey Task(6)
  261.    Device
  262.    Pause
  263.  
  264.  
  265. ;----- Novell Utilities Menu
  266.  
  267. :NovUtils
  268.  
  269. AddChoice('Session Management',1)
  270. AddChoice('File Management',2)
  271. AddChoice('Volume Information',3)
  272. AddChoice('System Configuration',4)
  273. AddChoice('File Server Monitoring',5)
  274. AddChoice('Print Queue Management',6)
  275. AddChoice('Print Job Configurations',7)
  276. AddChoice('Printer Definitions',8)
  277. AddChoice('Folio Help System',9)
  278.  
  279. CenterStretchBox ('Novell Utilities',38,15)
  280.  
  281. OnKey Task(1)
  282.    Session
  283.  
  284. OnKey Task(2)
  285.    Filer
  286.  
  287. OnKey Task(3)
  288.    VolInfo
  289.  
  290. OnKey Task(4)
  291.    Syscon
  292.  
  293. OnKey Task(5)
  294.    FConsole
  295.  
  296. OnKey Task(6)
  297.    PConsole
  298.  
  299. OnKey Task(7)
  300.    PrintCon
  301.  
  302. OnKey Task(8)
  303.    PrintDef
  304.  
  305. OnKey Task(9)
  306.    P:Help
  307.  
  308. ;----- Novell Information Menu
  309.  
  310. :NovInfo
  311.  
  312. AddChoice('UserList',1)
  313. AddChoice('Drive Map',2)
  314. AddChoice('Current Dir',3)
  315. AddChoice('Directory Rights',4)
  316. AddChoice('List Servers',5)
  317. AddChoice('Who Am I?',6)
  318. AddChoice('Trustees',7)
  319. AddChoice('System Time',8)
  320. AddChoice('ChkVol',9)
  321. AddChoice('Printer Status',10)
  322.  
  323. CenterStretchBox ('Novell Information',38,15)
  324.  
  325. OnKey Task(1)
  326.    UserList/A
  327.    Echo.
  328.    Pause
  329.  
  330. OnKey Task(2)
  331.    Map
  332.    Echo.
  333.    Pause
  334.  
  335. OnKey Task(3)
  336.    NDir
  337.    Pause
  338.  
  339. OnKey Task(4)
  340.    Rights
  341.    Echo.
  342.    Pause
  343.  
  344. OnKey Task(5)
  345.    SList
  346.    Echo.
  347.    Pause
  348.  
  349. OnKey Task(6)
  350.    WhoAmI/A
  351.    Echo.
  352.    Pause
  353.  
  354. OnKey Task(7)
  355.    TList
  356.    Echo.
  357.    Pause
  358.  
  359. OnKey Task(8)
  360.    SysTime
  361.    Echo.
  362.    Pause
  363.  
  364. OnKey Task(9)
  365.    ChkVol
  366.    Echo.
  367.    Pause
  368.  
  369. OnKey Task(10)
  370.    Capture Show
  371.    Echo.
  372.    Pause
  373.  
  374. ;----- Novell User Menu
  375.  
  376. :NovUser
  377.  
  378. AddChoice('Change Password',1)
  379. AddChoice('Block Messages',2)
  380. AddChoice('Receive Messages',3)
  381. AddChoice('End Printer Capture',4)
  382. AddChoice('Send a Message',5)
  383.  
  384. CenterStretchBox ('Novell User Menu',38,15)
  385.  
  386. OnKey Task(1)
  387.    SetPass
  388.  
  389. OnKey Task(2)
  390.    CastOff
  391.  
  392. OnKey Task(3)
  393.    CastOn
  394.  
  395. OnKey Task(4)
  396.    EndCap
  397.  
  398. OnKey Task(5)
  399.    |SendMessage
  400.  
  401. ;----- Maintenence Menu
  402.  
  403. :Maint
  404.  
  405. AddChoice('Tape Backup',1)
  406. AddChoice('Delete *.BAK Files',2)
  407. AddChoice('Delete *.MRX Files',3)
  408.  
  409. CenterStretchBox ('Maintenence Menu',38,15)
  410.  
  411. OnKey Task(1)
  412.    |Error('Put Code for your Tape Backup Software here.')
  413.  
  414. OnKey Task(2)
  415.    Whereis *.BAK /D
  416.  
  417. OnKey Task(3)
  418.    Whereis *.MRX /D
  419.  
  420. ;----- Menu Utilities
  421.  
  422. :MenuUtil
  423.  
  424. AddChoice('Edit this Menu',1)
  425. AddChoice('View Include Files',2)
  426. AddChoice('Edit Include Files',3)
  427. AddChoice('View a Menu File',4)
  428. AddChoice('Edit a Menu File',5)
  429. AddChoice('Run a Menu',6)
  430. AddChoice('Load MarxHelp',7)
  431. AddChoice('UnLoad MarxHelp',8)
  432.  
  433. CenterStretchBox ('Menu Utilities',38,15)
  434.  
  435. OnKey Task(1)
  436.    ME %MenuFileName
  437.  
  438. OnKey Task(2)
  439.    |FilePicked = PickAFile('*.INC','Include Files')
  440.    |ViewFile(FilePicked)
  441.  
  442. OnKey Task(3)
  443.    |FilePicked = GetIncludeFile
  444.    |if FilePicked > ''
  445.    |   Bat 'ME ' + FilePicked
  446.    |endif
  447.  
  448. OnKey Task(4)
  449.    |FilePicked = PickAFile ('*.MNU','Menus')
  450.    |ViewFile(FilePicked)
  451.  
  452. OnKey Task(5)
  453.    |FilePicked = PickAFile ('*.MNU','Menus')
  454.    |if FilePicked > ''
  455.    |   Bat 'ME ' + FilePicked
  456.    |endif
  457.  
  458. OnKey Task(6)
  459.    |FilePicked = PickAFile ('*.MNU','Menus')
  460.    |if FilePicked > ''
  461.    |   Bat 'MARX ' + FilePicked
  462.    |endif
  463.  
  464. OnKey Task(7)
  465.    |MxCmd = 'MarxHelp'
  466.  
  467. OnKey Task(8)
  468.    |MxCmd = 'MarxHelp /U'
  469.  
  470. ;----- This routines selects a print queue
  471.  
  472. Procedure SelectPrintQueue
  473. var Queue PrnPort QCmd
  474.    if NumberOfElements(PrintQueueChoices) = 0
  475.       NovPrintQueues(PrintQueueChoices)
  476.    endif
  477.    Choices = PrintQueueChoices
  478.    DrawTheBox(28,11,23,Min(12,NumberOfElements(Choices) + HeightDifference),'Print Queues')
  479.    Queue = PickOne(Choices)
  480.    if LastKey = Esc then Return
  481.    Choices = PortChoices
  482.    CenterStretchBox ('Port',38,20)
  483.    PrnPort = Char(Ord(ReadKey) - 16)
  484.    if LastKey = Esc then Return
  485.    EraseTopWindow
  486.    TextColor MenuHeaderFG MenuBG
  487.    ClearScreen
  488.    Write ' Working ...'
  489.    ClearScreenFirst Off
  490.    QCmd = 'Queue=' + Queue + ' C=1 NB NFF TimeOut=5 Local=' + PrnPort
  491.    ExecProg('Capture ' + QCmd + '>nul')
  492. EndProc
  493.  
  494. ;----- This routines selects floppy disk format
  495.  
  496. Procedure SelectFormat
  497. var Ch Message Option
  498.  
  499.    DrawTheBox(20,12,42,4 + HeightDifference,'Format Floppy Disk Menu')
  500.  
  501.    Writeln ' 1 - Format 360    5 - Format /S 360'
  502.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  503.    Writeln ' 3 - Format 720    7 - Format /S 720'
  504.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  505.  
  506.    Ch = ReadKey
  507.  
  508.    if Ch = '1'
  509.       Message = '360k Format with no System Files.'
  510.       Option = '/4'
  511.  
  512.    elseif Ch = '2'
  513.       Message = '1.2m Format with no System Files.'
  514.       Option = ''
  515.  
  516.    elseif Ch = '3'
  517.       Message = '720k Format with no System Files.'
  518.       Option = '/N:9/T:80'
  519.  
  520.    elseif Ch = '4'
  521.       Message = '1.4m Format with no System Files.'
  522.       Option = '/N:18/T:80'
  523.  
  524.    elseif Ch = '5'
  525.       Message = '360k Format with System Files.'
  526.       Option = '/4/S'
  527.  
  528.    elseif Ch = '6'
  529.       Message = '1.2m Format with System Files.'
  530.       Option = '/S'
  531.  
  532.    elseif Ch = '7'
  533.       Message = '720k Format with System Files.'
  534.       Option = '/N:9/T:80/S'
  535.  
  536.    elseif Ch = '8'
  537.       Message = '1.4m Format with System Files.'
  538.       Option = '/N:18/T:80/S'
  539.  
  540.    else
  541.       Return
  542.  
  543.    endif
  544.  
  545.    if DosVersionString >= '5.00'
  546.       Option = Option + '/U'     ;unconditional
  547.       Option = Option + '/V:DOS' ;automatically adds volume label
  548.    endif
  549.  
  550.    DrawTheBox(46,18,11,2 + HeightDifference,'Drive')
  551.    Writeln '  A:'
  552.    Write   '  B:'
  553.    Ch = ReadKey
  554.    if Ch = Esc then Return
  555.    ExecFormat(Ch,Option,Message)
  556. EndProc
  557.  
  558. ;----- Execute FORMAT in a DOS Window
  559.  
  560. Procedure ExecFormat (Drv,Option,Message)
  561. var FormatProg
  562.  
  563.    FormatProg = ExistOnPath('FORMAT.EXE')
  564.    if FormatProg = '' then FormatProg = ExistOnPath('FORMAT.COM')
  565.    if FormatProg = ''
  566.       Error('FORMAT program not Found!')
  567.       Return
  568.    endif
  569.  
  570.    BoxHeader = ' Formatting Drive ' + Drv + ': ' + Message + ' '
  571.    Shadow Off
  572.    DrawBox 1 4 80 21
  573.    Window  4 5 74 19
  574.    Writeln
  575.    ExecProg (FormatProg + ' ' + Drv + ': ' + Option)
  576.    EraseTopWindow
  577. EndProc
  578.  
  579. ;----- Sends a novell message
  580.  
  581. Procedure SendMessage
  582. var Choice Message
  583.    Choice = PickUser('Send message To')
  584.    if Choice = '' then Return
  585.    Message = ReadTextLine('Message:','',0,21)
  586.    if LastKey = Esc then Return
  587.    ClearScreen
  588.    TextColor MenuHeaderFG MenuBG
  589.    Write ' Sending ... '
  590.    ClearScreenFirst Off
  591.    ExecProg ('Send "' + Message + '" to ' + Choice + '>nul')
  592. EndProc
  593.  
  594. ;----- Select Include File
  595.  
  596. Procedure GetIncludeFile
  597. var IncPath
  598.    IncPath = PathPart(ExistOnPath('CUSTOM.INC'))
  599.    IncPath = PickAFile(CleanFileName(IncPath + '\*.INC'),'Include Files')
  600.    if IncPath = '' then Return ''
  601.    DelFile(ForceExtension(%MenuFileName,'MRX'))
  602.    Return IncPath
  603. EndProc
  604.  
  605. ;----- Reads a list of all users on the system
  606.  
  607. Procedure ReadUsers
  608.    if NumberOfElements(AllUsers) > 0 then Return
  609.    NovUsersLoggedIn(AllUsers)
  610.    SortArray(AllUsers)
  611. EndProc
  612.  
  613.  
  614. Procedure PickUser (Message)
  615. var MaxSize
  616.    ReadUsers
  617.    MaxSize = Min(15,NumberOfElements(AllUsers))
  618.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  619.    Return PickOne(AllUsers)
  620. EndProc
  621.  
  622. ;----- Execute a program in a window
  623.  
  624. Procedure ExecProg (Prog)
  625.    TextColor MenuHeaderFG MenuBG
  626.    Cursor Off
  627.    DosWindow
  628.    Execute Prog
  629. EndProc
  630.  
  631. ;----- View a File
  632.  
  633. Procedure ViewFile (Name)
  634.    if Name = '' then Return
  635.    BoxHeader = ' Viewing ' + Name + ' '
  636.    Shadow Off
  637.    DrawBox 1 4 80 21
  638.    TextColor MenuHeaderFG MenuBG
  639.    ViewTextFile Name
  640. EndProc
  641.  
  642. Procedure PickAFile (Mask,Message)
  643. var Files Choice MaxSize
  644.    ReadDirectory(Mask,Files)
  645.    MaxSize = Min(15,NumberOfElements(Files))
  646.    if MaxSize = 0
  647.       Error('No Choices!')
  648.       Return ''
  649.    endif
  650.    DrawTheBox(46,12 - (MaxSize / 2),20,MaxSize + HeightDifference,Message)
  651.    Choice = PickOne(Files)
  652.    Return Choice
  653. EndProc
  654.  
  655. ;----- Display Error and Wait for a Key
  656.  
  657. Procedure Error (Err)
  658. var Ch
  659.    BoxHeader = ' Error * Press any Key '
  660.    DrawBox 11 19 Max(27,length(Err) + 4) 3
  661.    Cursor Off
  662.    UseArrows Off
  663.    TextColor MenuHeaderFG MenuBG
  664.    WriteCenter Err
  665.    Write Char(7)
  666.    Ch = ReadKey
  667.    EraseTopWindow
  668. EndProc
  669.