home *** CD-ROM | disk | FTP | other *** search
/ Share Gallery 1 / share_gal_1.zip / share_gal_1 / UT / UT070.ZIP / MENUS.EXE / TYME.MNU < prev    next >
Text File  |  1991-03-31  |  15KB  |  704 lines

  1. Comment
  2. ==========================================================
  3.  
  4. Copyright 1990-91 by Marc Perkel * All right reserved.
  5.  
  6. This file is Computer Tyme's main system menu. It is written not
  7. only to be useful to us but to be an example of what can be done
  8. with MarxMenu.
  9.  
  10. =========================================================
  11. EndComment
  12.  
  13. ;------ Create Variables
  14.  
  15. Var
  16.   VertLine = "┬│││││││││││││││││││││││││││││││││││││││││││││"
  17.   VertLine2 = "││││││││││││││││││││"
  18.   VertLine3 = "┌─┴┴┴┴─┐"
  19.   VertLine4 = "└─┬┬┬┬─┘"
  20.   DefaultChoices = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
  21.   ThisDirectory
  22.   MainChoices
  23.   PrintQueueChoices
  24.   PortChoices
  25.   DosChoices
  26.   MaintChoices
  27.   NovUtilChoices
  28.   NovUserChoices
  29.   NovInfoChoices
  30.   MainChoiceMask
  31.   MyServer
  32.   AllUsers
  33.   NetAddress
  34.   Station
  35.   UserName
  36.   BMess
  37.   TitleBackColor
  38.   TitleInsideColor
  39.   UsersRead
  40.  
  41.  
  42. ;----- All environment string access will be the last Shell Environment
  43.  
  44. ShellEnvironment
  45.  
  46. OnScreenOnly
  47.  
  48. MyServer = NovDefaultServer
  49. Station  = Str(NovConnection)
  50. UserName = NovMyLoginName
  51.  
  52. ;------ Read network address
  53.  
  54. NetAddress = NovStationAddress (NovConnection)
  55.  
  56. BMess = 'User: ' + UserName + '  *  Server: ' + MyServer
  57. BMess = BMess + '  *  Address: ' + NetAddress + '  *  Dos: ' + DosVersionString
  58.  
  59. ;------ Select colors and prepare screen
  60.  
  61. SavePosition
  62. OnScreenOnly
  63. TitleBackColor = Brown
  64. TitleInsideColor = Yellow
  65. if ColorScreen
  66.    TextColor Cyan Blue
  67.    ClearScreen 176
  68.    GotoXY 1 25
  69.    TextColor Yellow Mag
  70.    ClearLine
  71.    WriteCenter BMess
  72.    TextColor Blue Green
  73.    GotoXY 4,4
  74.    WriteVertical VertLine2
  75.    GotoXY 5,4
  76.    WriteVertical VertLine2
  77.    GotoXY 6,4
  78.    WriteVertical VertLine2
  79.    GotoXY 7,4
  80.    WriteVertical VertLine2
  81.    GotoXY 74,4
  82.    WriteVertical VertLine2
  83.    GotoXY 75,4
  84.    WriteVertical VertLine2
  85.    GotoXY 76,4
  86.    WriteVertical VertLine2
  87.    GotoXY 77,4
  88.    WriteVertical VertLine2
  89.    GotoXY 2,4
  90.    Write VertLine4
  91.    GotoXY 72,4
  92.    Write VertLine4
  93.    GotoXY 2,24
  94.    Write VertLine3
  95.    GotoXY 72,24
  96.    Write VertLine3
  97.    BoxBorderColor White TitleBackColor
  98.    BoxInsideColor TitleInsideColor TitleBackColor
  99.    ClockColor TitleInsideColor TitleBackColor
  100.    TextColor TitleInsideColor TitleBackColor
  101. else
  102.    ClearScreen 176
  103.    TextColor Black Grey
  104.    GotoXY 1 25
  105.    ClearLine
  106.    ClearLine
  107.    WriteCenter BMess
  108.    BoxBorderColor Black Grey
  109.    BoxInsideColor Black Grey
  110.    ClockColor Black Grey
  111. endif
  112. SingleLineBox
  113. Explode Off
  114. DrawBox 1 1 80 3
  115. GotoXY (51,1)
  116. Write "Computer Tyme Master Menu"
  117. ClockPos 3 2
  118. DoubleLineBox
  119. ResetColors
  120.  
  121. LockWord = ""
  122. BlankTime = 10
  123. LogoffTime = 60
  124. UseArrows
  125. ThisDirectory = Path
  126.  
  127. Comment
  128. ==========================================================
  129.  
  130. I have defined a procedure called CenterStretchWindow which takes as
  131. parameters a menu title, array of choices, and the XY coordinants
  132. of the center of the window. CenterStretchWindow then displays all the
  133. choices and numbers them. This method allows me to update the menu
  134. more quickly.
  135.  
  136. ==========================================================
  137. EndComment
  138.  
  139. NovPrintQueues(PrintQueueChoices)
  140.  
  141. PortChoices[1] = 'Lpt1'
  142. PortChoices[2] = 'Lpt2'
  143. PortChoices[3] = 'Lpt3'
  144.  
  145. ;----- Main Menu
  146.  
  147. MainChoices[1]  = 'Command Line'
  148. MainChoices[2]  = 'Printer Select'
  149. MainChoices[3]  = 'Personal Menu'
  150. MainChoices[4]  = 'Create Disk Menu'
  151. MainChoices[5]  = 'Maintenance Menu'
  152. MainChoices[6]  = 'Format Disk Menu'
  153. MainChoices[7]  = 'Dos Functions'
  154. MainChoices[8]  = 'Novell Utilities'
  155. MainChoices[9]  = 'Novell Information'
  156. MainChoices[10] = 'Novell User Options'
  157.  
  158. MainChoiceMask = DefaultChoices
  159.  
  160. Comment
  161. ==========================================================
  162.  
  163. I have included a sample of how choices can be conditionally deleted
  164. from the men choices. The idea is to delete the choice from the
  165. selection array, and to insert a null character into MainChoiceMask at
  166. the position of the deleted choice. I recommend that choices be
  167. deleted from the end first working back to the beginning.
  168.  
  169. ==========================================================
  170. EndComment
  171.  
  172. if UserName <> 'MARC'
  173.    delete(MainChoices,5,1)
  174.    insert(char(0),MainChoiceMask,5)
  175. endif
  176.  
  177. CornerStretchWindow ('Main Menu',MainChoices,11,6)
  178.  
  179. OnKey Mid(MainChoiceMask,1,1)
  180.   |if ExistOnPath('DOLIST.EXE') > ''
  181.      DropTo DoList
  182.   |else
  183.   |  Bat 'DropTo ' + ReadEnv('COMSPEC')
  184.   |endif
  185.  
  186. OnKey Mid(MainChoiceMask,2,1)
  187.   |SelectPrintQueue
  188.   |LastKey = ' '
  189.  
  190. OnKey Mid(MainChoiceMask,3,1)
  191.   |if ExistFile ('Z:' + UserName + '.MNU')
  192.   |   Bat 'Marx ' + UserName
  193.   |endif
  194.  
  195. OnKey Mid(MainChoiceMask,4,1)
  196.   Marx MakeDisk
  197.  
  198. OnKey Mid(MainChoiceMask,5,1)
  199.   ^Maint
  200.  
  201. OnKey Mid(MainChoiceMask,6,1)
  202.   |SelectFormat
  203.   |LastKey = ' '
  204.  
  205. OnKey Mid(MainChoiceMask,7,1)
  206.   ^Dos
  207.  
  208. OnKey Mid(MainChoiceMask,8,1)
  209.   ^NovUtils
  210.  
  211. OnKey Mid(MainChoiceMask,9,1)
  212.   ^NovInfo
  213.  
  214. OnKey Mid(MainChoiceMask,10,1)
  215.   ^NovUser
  216.  
  217. OnKey Esc
  218.    ^Leave
  219.  
  220. ;----- Dos Menu
  221.  
  222. :Dos
  223.  
  224. DosChoices[1] = 'Memory Map'
  225. DosChoices[2] = 'Free Space'
  226. DosChoices[3] = 'Show Directory'
  227. DosChoices[4] = 'Pick Directory'
  228. DosChoices[5] = 'Directory Master'
  229.  
  230. CornerStretchWindow ('DOS Menu',DosChoices,43,6)
  231.  
  232. OnKey 'A'
  233.    MapMem
  234.    Pause
  235.  
  236. OnKey 'B'
  237.    Free
  238.    Pause
  239.  
  240. OnKey 'C'
  241.    D/W
  242.  
  243. OnKey 'D'
  244.    PD
  245.  
  246. OnKey 'E'
  247.   |if ExistOnPath('DM3.EXE') > ''
  248.      DropTo DM3
  249.   |else
  250.      DropTo DM
  251.   |endif
  252.  
  253.  
  254. ;----- Maintenence Menu
  255.  
  256. :Maint
  257.  
  258. MaintChoices[1] = 'Clean Up Files'
  259. MaintChoices[2] = 'Tape Backup'
  260. MaintChoices[3] = 'Edit Login Menu'
  261. MaintChoices[4] = 'Delete .MRX Files'
  262. MaintChoices[5] = 'Edit this Menu'
  263.  
  264. CornerStretchWindow ('Maintenence Menu',MaintChoices,43,6)
  265.  
  266. OnKey 'A'
  267.    Cleanup
  268.  
  269. OnKey 'B'
  270.    f:
  271.    cd\public\jumbo
  272.    Tape
  273.    |Bat Left(ThisDirectory,2)
  274.    |Bat 'cd ' + ThisDirectory
  275.  
  276. OnKey 'C'
  277.    L:
  278.    me login.mnu
  279.    marxcomp login
  280.    |Bat Left(ThisDirectory,2)
  281.    |Bat 'cd ' + ThisDirectory
  282.  
  283. OnKey 'D'
  284.    whereis *.mrx/d
  285.    L:
  286.    marxcomp login
  287.    |Bat Left(ThisDirectory,2)
  288.    |Bat 'cd ' + ThisDirectory
  289.  
  290. OnKey 'E'
  291.    me %MenuFileName
  292.  
  293.  
  294. ;----- Novell Utilities Menu
  295.  
  296. :NovUtils
  297.  
  298. NovUtilChoices[1] = 'Session Management'
  299. NovUtilChoices[2] = 'File Management'
  300. NovUtilChoices[3] = 'Volume Information'
  301. NovUtilChoices[4] = 'System Configuration'
  302. NovUtilChoices[5] = 'File Server Monitoring'
  303. NovUtilChoices[6] = 'Print Queue Management'
  304. NovUtilChoices[7] = 'Print Job Configurations'
  305. NovUtilChoices[8] = 'Printer Definitions'
  306. NovUtilChoices[9] = 'Folio Help System'
  307.  
  308. CenterStretchWindow ('Novell Utilities',NovUtilChoices,45,16)
  309.  
  310. OnKey 'A'
  311.    Session
  312.  
  313. OnKey 'B'
  314.    Filer
  315.  
  316. OnKey 'C'
  317.    VolInfo
  318.  
  319. OnKey 'D'
  320.    Syscon
  321.  
  322. OnKey 'E'
  323.    FConsole
  324.  
  325. OnKey 'F'
  326.    PConsole
  327.  
  328. OnKey 'G'
  329.    PrintCon
  330.  
  331. OnKey 'H'
  332.    PrintDef
  333.  
  334. OnKey 'I'
  335.    P:Help
  336.  
  337. ;----- Novell Information Menu
  338.  
  339. :NovInfo
  340.  
  341. NovInfoChoices[1]  = 'UserList'
  342. NovInfoChoices[2]  = 'Drive Map'
  343. NovInfoChoices[3]  = 'Current Dir'
  344. NovInfoChoices[4]  = 'Directory Rights'
  345. NovInfoChoices[5]  = 'List Servers'
  346. NovInfoChoices[6]  = 'Who Am I?'
  347. NovInfoChoices[7]  = 'Trustees'
  348. NovInfoChoices[8]  = 'System Time'
  349. NovInfoChoices[9]  = 'ChkVol'
  350. NovInfoChoices[10] = 'Printer Status'
  351.  
  352. CornerStretchWindow ('Novell Information',NovInfoChoices,43,6)
  353.  
  354. OnKey 'A'
  355.    UserList/A
  356.    Echo.
  357.    Pause
  358.  
  359. OnKey 'B'
  360.    Map
  361.    Echo.
  362.    Pause
  363.  
  364. OnKey 'C'
  365.    NDir
  366.    Pause
  367.  
  368. OnKey 'D'
  369.    Rights
  370.    Echo.
  371.    Pause
  372.  
  373. OnKey 'E'
  374.    SList
  375.    Echo.
  376.    Pause
  377.  
  378. OnKey 'F'
  379.    WhoAmI/A
  380.    Echo.
  381.    Pause
  382.  
  383. OnKey 'G'
  384.    TList
  385.    Echo.
  386.    Pause
  387.  
  388. OnKey 'H'
  389.    SysTime
  390.    Echo.
  391.    Pause
  392.  
  393. OnKey 'I'
  394.    ChkVol
  395.    Echo.
  396.    Pause
  397.  
  398. OnKey 'J'
  399.    Capture Show
  400.    Echo.
  401.    Pause
  402.  
  403. ;----- Novell User Menu
  404.  
  405. :NovUser
  406.  
  407. NovUserChoices[1] = 'Change Password'
  408. NovUserChoices[2] = 'Block Messages'
  409. NovUserChoices[3] = 'Receive Messages'
  410. NovUserChoices[4] = 'End Printer Capture'
  411. NovUserChoices[5] = 'Send a Message'
  412. NovUserChoices[6] = 'Lan Assist a User'
  413.  
  414. CenterStretchWindow ('Novell User Menu',NovUserChoices,56,11)
  415.  
  416. OnKey 'A'
  417.    SetPass
  418.  
  419. OnKey 'B'
  420.    CastOff
  421.  
  422. OnKey 'C'
  423.    CastOn
  424.  
  425. OnKey 'D'
  426.    EndCap
  427.  
  428. OnKey 'E'
  429.    |SendMessage
  430.  
  431. OnKey 'F'
  432.    |Bat ('LA ' + PickUser('Lan Assist Who'))
  433.  
  434. ;----- This routines selects a print queue
  435.  
  436. Procedure SelectPrintQueue
  437. var Queue PrnPort QCmd
  438.    CornerStretchWindow ('Print Queues',PrintQueueChoices,43,6)
  439.    Queue = max(ord(ReadKey) - 64,1)
  440.    Queue = UpperCase(PrintQueueChoices[Queue])
  441.    if LastKey = Esc then Return
  442.    CornerStretchWindow ('Port',PortChoices,44,17)
  443.    PrnPort = Char(Ord(ReadKey) - 16)
  444.    if LastKey = Esc then Return
  445.    EraseTopWindow
  446.    ClearScreen
  447.    TextColor Yellow Blue
  448.    Write ' Working '
  449.    ResetColors
  450.    ClearScreenFirst Off
  451.    QCmd = 'Queue=' + Queue + ' C=1 NB NFF TimeOut=5 Local=' + PrnPort
  452.    Execute('Capture ' + QCmd + '>nul')
  453. EndProc
  454.  
  455. ;----- This routines selects floppy disk format
  456.  
  457. Procedure SelectFormat
  458. var Ch Message Option BoxDim
  459.    BoxDim[1] = 30
  460.    BoxDim[2] = 12
  461.    BoxDim[3] = 37
  462.    BoxDim[4] = 4
  463.    DrawStretchWindow('Format Floppy Disk Menu',BoxDim)
  464.    Writeln ' 1 - Format 360    5 - Format /S 360'
  465.    Writeln ' 2 - Format 1.2M   6 - Format /S 1.2M'
  466.    Writeln ' 3 - Format 720    7 - Format /S 720'
  467.    Write   ' 4 - Format 1.4M   8 - Format /S 1.4M'
  468.    Ch = ReadKey
  469.    if Ch = '1'
  470.       Message = '360k Format with no System Files.'
  471.       Option = '/4'
  472.    endif
  473.    if Ch = '2'
  474.       Message = '1.2m Format with no System Files.'
  475.       Option = ''
  476.    endif
  477.    if Ch = '3'
  478.       Message = '720k Format with no System Files.'
  479.       Option = '/N:9/T:80'
  480.    endif
  481.    if Ch = '4'
  482.       Message = '1.4m Format with no System Files.'
  483.       Option = '/N:18/T:80'
  484.    endif
  485.    if Ch = '5'
  486.       Message = '360k Format with System Files.'
  487.       Option = '/4/S'
  488.    endif
  489.    if Ch = '6'
  490.       Message = '1.2m Format with System Files.'
  491.       Option = '/S'
  492.    endif
  493.    if Ch = '7'
  494.       Message = '720k Format with System Files.'
  495.       Option = '/N:9/T:80/S'
  496.    endif
  497.    if Ch = '8'
  498.       Message = '1.4m Format with System Files.'
  499.       Option = '/N:18/T:80/S'
  500.    endif
  501.    if Message = '' then Return
  502.    BoxDim[1] = 56
  503.    BoxDim[2] = 18
  504.    BoxDim[3] = 5
  505.    BoxDim[4] = 2
  506.    DrawStretchWindow('Drive',BoxDim)
  507.    Writeln '  A:'
  508.    Write   '  B:'
  509.    Ch = ReadKey
  510.    if Ch = Esc then Return
  511.    if DosVersionString >= '5.00' then Option = Option + '/U';
  512.    if Ch = 'A'
  513.       Bat '@Echo Formatting Drive A: ' + Message
  514.       Bat '@Echo To abort, press CTRL-C.'
  515.       Bat '@Echo .'
  516.       Bat 'FORMAT A:' + Option
  517.    endif
  518.    if Ch = 'B'
  519.       Bat '@Echo Formatting Drive B: ' + Message
  520.       Bat '@Echo To abort, press CTRL-C.'
  521.       Bat '@Echo .'
  522.       Bat 'FORMAT B:' + Option
  523.    endif
  524. EndProc
  525.  
  526.  
  527. Procedure SendMessage
  528. var BoxDim Choice Message
  529.    Choice = PickUser('Send message To')
  530.    BoxDim[1] = 14
  531.    BoxDim[2] = 23
  532.    BoxDim[3] = 52
  533.    BoxDim[4] = 1
  534.    DrawStretchWindow('Enter the Message that you Wish to Send',BoxDim)
  535.    Write ' '
  536.    Message = Readln
  537.    if LastKey = Esc then Return
  538.    ClearScreen
  539.    TextColor Yellow Blue
  540.    Write ' Sending ... '
  541.    ClearScreenFirst Off
  542.    Execute 'Send "' + Message + '" to ' + Choice + '>nul'
  543.    ResetColors
  544. EndProc
  545.  
  546.  
  547. ;------ Reset Colors Procedure
  548.  
  549. Procedure ResetColors
  550.    if ColorScreen
  551.       BoxBorderColor Yellow Blue
  552.       BoxInsideColor Yellow Blue
  553.       CapsColor White Blue
  554.       InverseColor White Mag
  555.    else
  556.       BoxBorderColor Grey Black
  557.       BoxInsideColor Grey Black
  558.       CapsColor White Black
  559.    endif
  560. EndProc
  561.  
  562. ;----- This routines is used to actually draw the stretch window
  563.  
  564. Procedure DrawStretchWindow (Title,BoxDim)
  565.    Explode On
  566.    DoubleLineBox
  567.    InactiveBox SingleLineBox
  568.    DrawBox (BoxDim[1] - 2, BoxDim[2] - 3 ,BoxDim[3] + 6, BoxDim[4] + 4)
  569.    TextColor LCyan Blue
  570.    WriteCenter Title
  571.    TextColor LGreen Blue
  572.    Writeln
  573.    ClearLine 196
  574.    GotoXY 2 2
  575.    WriteVertical mid(VertLine,1,BoxDim[4] + 1)
  576.    ResetColors
  577.    Explode Off
  578.    NoBoxBorder
  579.    Window (BoxDim[1] + 1, BoxDim[2], BoxDim[3] + 2, BoxDim[4])
  580.    DoubleLineBox
  581.    Explode On
  582. EndProc
  583.  
  584. ;----- The X Y parameters are the center of the box
  585.  
  586. Procedure CenterStretchWindow (Title, Choices, X, Y)
  587. var Longest BoxDim NumElem C
  588.    Longest = length(Title) - 2
  589.    NumElem = NumberOfElements(Choices)
  590.    C = 64
  591.    Loop NumElem
  592.       Choices[LoopIndex] = Char(C + LoopIndex) + ' - ' + Choices[LoopIndex]
  593.       Longest = Max(Longest,length(Choices[LoopIndex]))
  594.    EndLoop
  595.    BoxDim[1] = X - (Longest / 2) - 1
  596.    BoxDim[2] = Y - (NumElem / 2) + 1
  597.    BoxDim[3] = Longest
  598.    BoxDim[4] = NumElem
  599.    DrawStretchWindow(Title,BoxDim)
  600.    Loop NumElem
  601.       Write ' ' Choices[LoopIndex]
  602.       if LoopIndex < NumElem then Writeln
  603.    EndLoop
  604. EndProc
  605.  
  606. ;----- The X Y parameters are the corner of the box
  607.  
  608. Procedure CornerStretchWindow (Title, Choices, X, Y)
  609. var Longest BoxDim NumElem C
  610.    Longest = length(Title) - 2
  611.    NumElem = NumberOfElements(Choices)
  612.    C = 64
  613.    Loop NumElem
  614.       Choices[LoopIndex] = Char(C + LoopIndex) + ' - ' + Choices[LoopIndex]
  615.       Longest = Max(Longest,length(Choices[LoopIndex]))
  616.    EndLoop
  617.    BoxDim[1] = X + 2
  618.    BoxDim[2] = Y + 3
  619.    BoxDim[3] = Longest
  620.    BoxDim[4] = NumElem
  621.    DrawStretchWindow(Title,BoxDim)
  622.    Loop NumElem
  623.       Write ' ' Choices[LoopIndex]
  624.       if LoopIndex < NumElem then Writeln
  625.    EndLoop
  626. EndProc
  627.  
  628. ;----- Recursive QuickSort
  629.  
  630. Procedure SortUsers (L,R)
  631. var I J Middle
  632.    I = L
  633.    J = R
  634.    Middle = AllUsers[(L+R)/2]
  635.    repeat
  636.       while AllUsers[I] < Middle
  637.          I = I + 1
  638.       endwhile
  639.       while Middle < AllUsers[J]
  640.          J = J - 1
  641.       endwhile
  642.       if I <= J
  643.          Middle = AllUsers[J]
  644.          AllUsers[J] = AllUsers[I]
  645.          AllUsers[I] = Middle
  646.          I = I + 1
  647.          J = J - 1
  648.       endif
  649.    until I > J
  650.    if (J - L) < (R - I)
  651.       if L < J then SortUsers(L,J);
  652.       if I < R then SortUsers(I,R);
  653.    else
  654.       if I < R then SortUsers(I,R);
  655.       if L < J then SortUsers(L,J);
  656.    endif
  657. EndProc
  658.  
  659. ;----- Reads a list of all users on the system
  660.  
  661. Procedure ReadUsers
  662.    if UsersRead then Return
  663.    NovUsersLoggedIn(AllUsers)
  664.    SortUsers(1,NumberOfElements(AllUsers))
  665.    UsersRead = True
  666. EndProc
  667.  
  668. Procedure PickUser (Message)
  669. var BoxDim
  670.    ReadUsers
  671.    BoxDim[1] = 32
  672.    BoxDim[2] = 14
  673.    BoxDim[3] = 17
  674.    BoxDim[4] = Min(8,NumberOfElements(AllUsers))
  675.    DrawStretchWindow(Message,BoxDim)
  676.    Return PickOne(AllUsers)
  677. EndProc
  678.  
  679. ;------ MenuExit Procedure
  680.  
  681. :Leave
  682.    Explode On
  683.    DrawBox 36 11 13 6
  684.    TextColor LCyan Blue
  685.    WriteCenter "Exit Menu"
  686.    TextColor LGreen Blue
  687.    Writeln
  688.    ClearLine 196
  689.    GotoXY 2 2
  690.    WriteVertical mid(VertLine,1,3)
  691.    ResetColors
  692.    Explode Off
  693.    NoBoxBorder
  694.    Window 39 14 9 2
  695.    Writeln " Yes"
  696.    Write   " No"
  697.    DoubleLineBox
  698.    OnKey "Y"
  699.       |ExitMenu
  700.  
  701.    OnKey "N"
  702.       |LastKey = Esc
  703.  
  704.