home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1998 July & August / Pcwk78b98.iso / Smart30 / ENGLISH / PRODUCTS / LOTUS018.DSK / MASTRDOC.SMM < prev    next >
INI File  |  1992-06-05  |  11KB  |  670 lines

  1. [ver]
  2.     4
  3. [sty]
  4.     _macro.sty
  5. [files]
  6. [charset]
  7.     82
  8.     ANSI (Windows, IBM CP 1252)
  9. [revisions]
  10.     0
  11. [prn]
  12.     PostScript Printer
  13. [port]
  14.     LPT1:
  15. [lang]
  16.     1
  17. [desc]
  18.     Browse files of a master document
  19.     Lotus Word Processing Division
  20.     Advanced
  21.     Define, MasterDoc
  22.     autorun
  23.     707773333
  24.     14
  25.     676166658
  26.     156
  27.     5
  28.     0
  29.     0
  30.     0
  31.     0
  32.     
  33.     
  34.     
  35.     
  36.     
  37.     
  38.     0
  39. [fopts]
  40.     0
  41.     1
  42.     0
  43.     0
  44. [lnopts]
  45.     2
  46.     Body Text
  47.     1
  48. [docopts]
  49.     5
  50.     2
  51. [GramStyle]
  52.     
  53. [ParaNum]
  54.     1
  55. [l1]
  56.     0
  57. [pg]
  58.     5
  59.     40 0 17 512 0 0 0 65535 65535 Standard    65535 0 0    0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
  60.     82 0 17 512 0 0 0 65535 65535 Standard    65535 0 0    0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
  61.     126 0 16 0 0 1 0 65535 65535 Standard    65535 0 0    0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
  62.     136 0 5 512 0 0 0 65535 65535 Standard    65535 0 0    0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
  63.     163 0 0 1025 0 0 0 65535 65535 Standard    65535 0 0    0 0 0 0 0 0 0 65535 0 0 65535 0 0 0 0 0
  64. [edoc]
  65. <:#568,9360>' Master File Browser  - these macros will allow the user to "Next" and "Prev" through the files
  66.  
  67. <:#568,9360>' of a master document.   We add a cascading menu off the file menu.  Here they can "INIT" , 
  68.  
  69. <:#284,9360>' Next and Prev.
  70.  
  71. <:#284,9360>' We keep the filenames in a global array.
  72.  
  73. <:#284,9360>
  74.  
  75. <:#284,9360>DEFINE    GlobID         "MasterFiles"
  76.  
  77. <:#284,9360>DEFINE    GlobIDC        "MasterCount"
  78.  
  79. <:#284,9360>DEFINE    GetFile(which)    GetGlobalArray$(GlobID, %1)
  80.  
  81. <:#284,9360>DEFINE    MaxID()        GetGlobalArray$(GlobIDC, 1)
  82.  
  83. <:#284,9360>DEFINE    SetMaxID(max)    SetGlobalArray(GlobIDC, 1, %1)
  84.  
  85. <:#284,9360>DEFINE    SetFile(index, name)    SetGlobalArray(GlobID, %1, %2)
  86.  
  87. <:#284,9360>declare    AlreadyOpened(p1)
  88.  
  89. <:#284,9360>Declare OpenOne(p1)
  90.  
  91. <:#284,9360>
  92.  
  93. <:#284,9360>' AddOurMenu - This just adds us to the menu
  94.  
  95. <:#284,9360>
  96.  
  97. @Function@<:#293,9360>FUNCTION AddOurMenu()
  98.  
  99. <:#284,9360>IF IsNewWave()
  100.  
  101. <:#284,9360>    Message("Macro not available while running under HP NewWave.")
  102.  
  103. <:#284,9360>    Exit Function
  104.  
  105. <:#284,9360>ENDIF
  106.  
  107. <:#284,9360>'singlestep(0)
  108.  
  109. <:#284,9360>AllocGlobalVar("Init",1)
  110.  
  111. <:#284,9360>SetGlobalVar("Init",0)
  112.  
  113. <:#284,9360>
  114.  
  115. <:#284,9360>menu = "&File";                    ' Which menu
  116.  
  117. <:#284,9360>submenu = "&Master Browser";            ' Our name
  118.  
  119. <:#284,9360>DeleteMenu(1, menu, Submenu);            ' Delete old if there
  120.  
  121. <:#284,9360>
  122.  
  123. <:#284,9360>InsertCascadeMenu(1, menu, 8, submenu)
  124.  
  125. <:#284,9360>
  126.  
  127. <:#284,9360>InitMac = StrCat$(GetRunningMacroFile$(), "!OpenMaster")
  128.  
  129. <:#568,9360>AddCascadeMenuItem(1, menu, submenu, "&Init", InitMac, "Inititalize Browser new master file")
  130.  
  131. <:#284,9360>
  132.  
  133. <:#284,9360>NextMac = StrCat$(GetRunningMacroFile$(), "!NextMaster")
  134.  
  135. <:#568,9360>AddCascadeMenuItem(1, menu, submenu, "&Next_Master", NextMac, "Next Master File")
  136.  
  137. <:#284,9360>
  138.  
  139. <:#284,9360>PrevMac = StrCat$(GetRunningMacroFile$(), "!PrevMaster")
  140.  
  141. <:#568,9360>AddCascadeMenuItem(1, menu, submenu, "&Prev_Master", PrevMac, "Previous Master File")
  142.  
  143. END FUNCTION<:p<* >>
  144.  
  145. <:#284,9360>
  146.  
  147. <:#568,9360>' OpenMaster - Get the list of files for a master document, then load them into the global array
  148.  
  149. <:#284,9360>
  150.  
  151. @Function@<:#293,9360>FUNCTION OpenMaster()
  152.  
  153. <:#284,9360>'singlestep(0)
  154.  
  155. <:#284,9360>defstr mascount;
  156.  
  157. <:#284,9360>if (0 = Assign(&mascount, GetMasterFilesCount()))
  158.  
  159. <:#284,9360>    message("The current document is not a master.")
  160.  
  161. <:#284,9360>    return -1;
  162.  
  163. <:#284,9360>endif
  164.  
  165. <:#284,9360>AllocGlobalVar(GlobID, mascount)            ' Where we keep the names
  166.  
  167. <:#284,9360>AllocGlobalVar(GlobIDC, 1)                ' How we know how many
  168.  
  169. <:#284,9360>SetGlobalVar("Init",1)
  170.  
  171. <:#284,9360>dim    masfiles(mascount)                ' load our local array
  172.  
  173. <:#284,9360>GetMasterFiles(&masfiles)                ' then transfer them to the 
  174.  
  175. <:#284,9360>for i = 1 to mascount                    ' Global array
  176.  
  177. <:#284,9360>    SetFile(i, UCase$(masfiles(i)))        ' Upper case all for compares later
  178.  
  179. <:#284,9360>next
  180.  
  181. <:#284,9360>SetMaxID(mascount)
  182.  
  183. <:#284,9360>
  184.  
  185. <:#284,9360>' Now load the first master file.
  186.  
  187. <:#284,9360>
  188.  
  189. <:#284,9360>fname = masfiles(1)
  190.  
  191. <:#284,9360>if (AlreadyOpened(fname))
  192.  
  193. <:#284,9360>    SelectWindow(fname)
  194.  
  195. <:#284,9360>else
  196.  
  197. <:#284,9360>    OpenOne(masfiles(1))
  198.  
  199. <:#284,9360>endif
  200.  
  201. <:#284,9360>END FUNCTION
  202.  
  203. <:#284,9360>
  204.  
  205. <:#284,9360>' IsCurrentAMaster - is the active window one of the master files?
  206.  
  207. <:#284,9360>'    RETURN 0 if not one of the master files otherwise its ordered number
  208.  
  209. <:#284,9360>
  210.  
  211. @Function@<:#293,9360>FUNCTION IsCurrentAMaster()
  212.  
  213. <:#284,9360>cur = UCase$(GetOpenFileName$())        ' Upper case the current
  214.  
  215. <:#284,9360>for i = 1 to MaxID()                ' Run though all master files
  216.  
  217. <:#284,9360>    if (cur = GetFile(i))            ' Found one?
  218.  
  219. <:#284,9360>        return i                ' Yes, return its index
  220.  
  221. <:#284,9360>    endif
  222.  
  223. <:#284,9360>next
  224.  
  225. <:#284,9360>return 0;                    ' Not found.
  226.  
  227. END FUNCTION<:p<* >>
  228.  
  229. <:#284,9360>
  230.  
  231. <:#568,9360>' NextMaster - Called from the menu.  Get the active window's file, determine if its part of the 
  232.  
  233. <:#284,9360>'    master file, if so either open or select the next file.
  234.  
  235. <:#284,9360>'
  236.  
  237. @Function@<:#293,9360>FUNCTION NextMaster()
  238.  
  239. <:#284,9360>Declare AlreadyOpened(p1)
  240.  
  241. <:#284,9360>InitStat = GetGlobalVar$("Init")
  242.  
  243. <:#284,9360>If InitStat = 0
  244.  
  245. <:#284,9360>    Message("Please select the Init function")
  246.  
  247. <:#284,9360>    Exit Function
  248.  
  249. <:#284,9360>Endif
  250.  
  251. <:#284,9360>id = IsCurrentAMaster()            ' The active window part of master document?
  252.  
  253. <:#284,9360>if (0 != id AND id << MaxID())
  254.  
  255. <:#284,9360>
  256.  
  257. <:#284,9360>    ' NOTE the parentheses around the id + 1, is required for the define's parameter 
  258.  
  259. <:#284,9360>    ' substitution.  Without the parentheses there would be 3 parameters, not 1!
  260.  
  261. <:#284,9360>
  262.  
  263. <:#284,9360>    fname = GetFile((id + 1))        ' Get the next one
  264.  
  265. <:#284,9360>    if NOT AlreadyOpened(fname)    ' If its not opened
  266.  
  267. <:#284,9360>        OpenOne(fname)        ' Open it
  268.  
  269. <:#284,9360>    else
  270.  
  271. <:#284,9360>        SelectWindow(fname)    ' Otherwise just select it
  272.  
  273. <:#284,9360>    endif
  274.  
  275. <:#284,9360>elseif (0 = id)
  276.  
  277. <:#284,9360>    Message("The current file is not part of the selected master file.")
  278.  
  279. <:#284,9360>else
  280.  
  281. <:#284,9360>    Message("No more files.")
  282.  
  283. <:#284,9360>endif
  284.  
  285. <:#284,9360>END FUNCTION
  286.  
  287. <:#284,9360>
  288.  
  289. <:#284,9360>' PrevMaster - select the previous file.
  290.  
  291. <:#284,9360>
  292.  
  293. @Function@<:#293,9360>FUNCTION PrevMaster()
  294.  
  295. <:#284,9360>InitStat = GetGlobalVar$("Init")
  296.  
  297. <:#284,9360>If InitStat = 0
  298.  
  299. <:#284,9360>    Message("Please select the Init function")
  300.  
  301. <:#284,9360>    Exit Function
  302.  
  303. <:#284,9360>Endif
  304.  
  305. <:#284,9360>
  306.  
  307. <:#284,9360>id = IsCurrentAMaster()
  308.  
  309. <:#284,9360>if (id <;> 1)
  310.  
  311. <:#284,9360>    fname = GetFile((id - 1))
  312.  
  313. <:#284,9360>    if NOT AlreadyOpened(fname)
  314.  
  315. <:#284,9360>        OpenOne(fname)
  316.  
  317. <:#284,9360>    else
  318.  
  319. <:#284,9360>        SelectWindow(fname)
  320.  
  321. <:#284,9360>    endif
  322.  
  323. <:#284,9360>elseif (0 = id)
  324.  
  325. <:#284,9360>    Message("The current file is not part of the selected master file.")
  326.  
  327. <:#284,9360>else
  328.  
  329. <:#284,9360>    Message("This is the first file in the master document.")
  330.  
  331. <:#284,9360>endif
  332.  
  333. <:#284,9360>END FUNCTION
  334.  
  335. <:p<* >>
  336.  
  337. <:#240,9360>' AlreadyOpened - is the passed file already open?
  338.  
  339. <:#240,9360>'     RETURN TRUE is so.
  340.  
  341. <:#240,9360>
  342.  
  343. @Function@<:#240,9360>FUNCTION AlreadyOpened(fname)
  344.  
  345. <:#240,9360>filecnt = GetOpenFileCount()
  346.  
  347. <:#240,9360>dim files(filecnt)
  348.  
  349. <:#240,9360>GetOpenFileNames(&files)            ' Get the list of files
  350.  
  351. <:#240,9360>for i = 1 to filecnt
  352.  
  353. <:#240,9360>    if (fname = files(i))            ' match?
  354.  
  355. <:#240,9360>        return 1;            ' Is is open.
  356.  
  357. <:#240,9360>    endif
  358.  
  359. <:#240,9360>next
  360.  
  361. <:#240,9360>return 0;                    ' No open
  362.  
  363. <:#240,9360>END FUNCTION
  364.  
  365. <:#240,9360>
  366.  
  367. <:#480,9360>' OpenOne - Open a file, give it its own window, if we dont already have 9 open.
  368.  
  369. <:#240,9360>
  370.  
  371. @Function@<:#240,9360>FUNCTION OpenOne(fname)
  372.  
  373. <:#240,9360>cnt = GetOpenFileCount()
  374.  
  375. <:#240,9360>if (cnt << 9)
  376.  
  377. <:#240,9360>    openopt = 1
  378.  
  379. <:#240,9360>else
  380.  
  381. <:#240,9360>    openopt = 129
  382.  
  383. <:#240,9360>endif
  384.  
  385. <:#240,9360>FileOpen(fname, openopt, "")
  386.  
  387. <:#240,9360>END FUNCTION
  388.  
  389. <:#284,9360>
  390.  
  391. >
  392.  
  393. [Embedded]
  394. 00008040
  395. >
  396. [macsum] 7
  397. AddOurMenu 0 0 6 16
  398. OpenMaster 572 0 5 43
  399. IsCurrentAMaster 1096 0 3 73
  400. NextMaster 1358 0 4 86
  401. PrevMaster 1871 0 4 114
  402. AlreadyOpened 2373 1 4 139
  403. OpenOne 2603 1 3 153
  404. [macse]
  405. 14 AddOurMenu
  406. 0 1317
  407. 13
  408. 11 00000111
  409. 0 3 "Macro not available while running under HP NewWave."
  410. 6 0
  411. 15
  412. 9
  413. 0 271 "Init" 1
  414. 0 264 "Init" 0
  415. 7 "&File"
  416. 8 1
  417. 7 "&Master Browser"
  418. 8 2
  419. 0 521 1 "{1}" "{2}"
  420. 0 528 1 "{1}" 8 "{2}"
  421. 0 802
  422. 13
  423. 0 16 [X] "!OpenMaster"
  424. 13
  425. 8 3
  426. 0 525 1 "{1}" "{2}" "&Init" "{3}" "Inititalize Browser new master file"
  427. 0 802
  428. 13
  429. 0 16 [X] "!NextMaster"
  430. 13
  431. 8 4
  432. 0 525 1 "{1}" "{2}" "&Next_Master" "{4}" "Next Master File"
  433. 0 802
  434. 13
  435. 0 16 [X] "!PrevMaster"
  436. 13
  437. 8 5
  438. 0 525 1 "{1}" "{2}" "&Prev_Master" "{5}" "Previous Master File"
  439. 6 0
  440. 15
  441. 9
  442. 14 OpenMaster
  443. 5 0
  444. 0 1047
  445. 13
  446. 0 805 &1 [X]
  447. 13
  448. 18 0
  449. 11 00000127
  450. 0 3 "The current document is not a master."
  451. 5 -1
  452. 15
  453. 9
  454. 0 271 "MasterFiles" "{1}"
  455. 0 271 "MasterCount" 1
  456. 0 264 "Init" 1
  457. 6 1
  458. 21 2 [X]
  459. 0 1048 &2
  460. 5 1
  461. 8 3
  462. 6 1
  463. 6 3
  464. 18 2
  465. 12 00000304
  466. 10 00000373
  467. 5 1
  468. 6 3
  469. 3 0
  470. 8 3
  471. 10 00000229
  472. 6 3
  473. 22 2
  474. 0 18 [X]
  475. 13
  476. 0 272 "MasterFiles" "{3}" [X]
  477. 10 00000271
  478. 0 272 "MasterCount" 1 "{1}"
  479. 5 1
  480. 22 2
  481. 8 4
  482. 16 AlreadyOpened "{4}"
  483. 13
  484. 11 00000485
  485. 0 796 "{4}"
  486. 10 00000512
  487. 5 1
  488. 22 2
  489. 16 OpenOne [X]
  490. 6 0
  491. 15
  492. 9
  493. 14 IsCurrentAMaster
  494. 0 267
  495. 13
  496. 0 18 [X]
  497. 13
  498. 8 1
  499. 5 1
  500. 8 2
  501. 0 273 "MasterCount" 1
  502. 13
  503. 6 2
  504. 18 2
  505. 12 00000158
  506. 10 00000238
  507. 5 1
  508. 6 2
  509. 3 0
  510. 8 2
  511. 10 00000061
  512. 6 1
  513. 0 273 "MasterFiles" "{2}"
  514. 13
  515. 18 0
  516. 11 00000225
  517. 6 2
  518. 15
  519. 9
  520. 10 00000125
  521. 5 0
  522. 15
  523. 9
  524. 6 0
  525. 15
  526. 9
  527. 14 NextMaster
  528. 0 265 "Init"
  529. 13
  530. 8 1
  531. 6 1
  532. 5 0
  533. 18 0
  534. 11 00000118
  535. 0 3 "Please select the Init function"
  536. 6 0
  537. 15
  538. 9
  539. 16 IsCurrentAMaster
  540. 13
  541. 8 2
  542. 5 0
  543. 6 2
  544. 18 1
  545. 6 2
  546. 0 273 "MasterCount" 1
  547. 13
  548. 18 5
  549. 1 1
  550. 11 00000372
  551. 6 2
  552. 5 1
  553. 3 0
  554. 0 273 "MasterFiles" [X]
  555. 13
  556. 8 3
  557. 16 AlreadyOpened "{3}"
  558. 13
  559. 1 3
  560. 11 00000346
  561. 16 OpenOne "{3}"
  562. 10 00000359
  563. 0 796 "{3}"
  564. 10 00000501
  565. 5 0
  566. 6 2
  567. 18 0
  568. 11 00000479
  569. 0 3 "The current file is not part of the selected master file."
  570. 10 00000501
  571. 0 3 "No more files."
  572. 6 0
  573. 15
  574. 9
  575. 14 PrevMaster
  576. 0 265 "Init"
  577. 13
  578. 8 1
  579. 6 1
  580. 5 0
  581. 18 0
  582. 11 00000118
  583. 0 3 "Please select the Init function"
  584. 6 0
  585. 15
  586. 9
  587. 16 IsCurrentAMaster
  588. 13
  589. 8 2
  590. 6 2
  591. 5 1
  592. 18 3
  593. 11 00000329
  594. 6 2
  595. 5 1
  596. 3 1
  597. 0 273 "MasterFiles" [X]
  598. 13
  599. 8 3
  600. 16 AlreadyOpened "{3}"
  601. 13
  602. 1 3
  603. 11 00000303
  604. 16 OpenOne "{3}"
  605. 10 00000316
  606. 0 796 "{3}"
  607. 10 00000490
  608. 5 0
  609. 6 2
  610. 18 0
  611. 11 00000436
  612. 0 3 "The current file is not part of the selected master file."
  613. 10 00000490
  614. 0 3 "This is the first file in the master document."
  615. 6 0
  616. 15
  617. 9
  618. 14 AlreadyOpened
  619. 0 1050
  620. 13
  621. 8 2
  622. 6 2
  623. 21 3 [X]
  624. 0 1051 &3
  625. 5 1
  626. 8 4
  627. 6 2
  628. 6 4
  629. 18 2
  630. 12 00000146
  631. 10 00000206
  632. 5 1
  633. 6 4
  634. 3 0
  635. 8 4
  636. 10 00000071
  637. 6 0
  638. 6 4
  639. 22 3
  640. 18 0
  641. 11 00000193
  642. 5 1
  643. 15
  644. 9
  645. 10 00000113
  646. 5 0
  647. 15
  648. 9
  649. 6 1
  650. 15
  651. 9
  652. 14 OpenOne
  653. 0 1050
  654. 13
  655. 8 2
  656. 6 2
  657. 5 9
  658. 18 5
  659. 11 00000081
  660. 5 1
  661. 8 3
  662. 10 00000093
  663. 5 129
  664. 8 3
  665. 2 102 1 "{0}" "{3}" ""
  666. 6 1
  667. 15
  668. 9
  669. 00008065
  670.