Loading ...
Sorry, an error occurred while loading the content.

4563Re: [Clip] Clip bar library versus the current library [2]

Expand Messages
  • Eb Guenther
    Sep 3, 2000
    • 0 Attachment
      Hi Jody, Larry,

      >I don't know exactly what you are doing,

      Me neither, ain't it exciting?! But if you are looking
      for something to read, below is the clip I was building
      for my clipbar, my own version of Charlie Raine's "Quickie
      Librarian".

      It displays a check list with active libraries pre-selected,
      and inactive (hidden) libs unselected. Once the new list is
      chosen, it is presented for selecting a new current library.

      I finally chose to use Jody's Keyboard command, simplified,
      even though it leaves me in an undefined state ("SetFocus"
      has no complementary "Get" function), and even though I'm
      never comfortable with scripting keyboard commands, since
      a keyboard could be redefined.

      BTW Larry, capturing the library name in each library
      will not work for default libraries (Utilities, Samples,
      etc) nor imported libraries, as they do not have the
      required command to capture the name in OnOpen.


      To make it easier to read, and provide comments for new NTabbers,
      I've isolated command lines between ";--- comment" lines.


      H="EbsQuickLib"
      ; Select (checkbox) libraries to be included in Active list
      ; by Eb Guenther <ntp@...>
      ;Inspired by Charlie Raine's "Quickie Librarian"
      ;--- delimit arrays for wizard
      ^!SetListDelimiter |
      ;--- get visible libraries, swap %NL% for "|", pre-select ("_")
      ^!Set %ActvLibs%=_^$StrReplace(^%NL%;"|_";"^$GetDosOutput(dir /b
      "^$GetLibraryPath$*.clb")$";0;0)$
      ;--- lop off trailing "_" (passive list joined after last "|")
      ^!SetArray %ActvLibs%=^$StrDeleteRight(^%ActvLibs%;1)$
      ;--- get hidden libraries (same as above, but don't pre-select)
      ^!Set %PassLibs%=^$StrReplace(^%NL%;"|";"^$GetDosOutput(dir /a:H /b
      "^$GetLibraryPath$*.clb")$";0;0)$
      ;--- lop off trailing "|"
      ^!SetArray %PassLibs%=^$StrDeleteRight(^%PassLibs%;1)$
      ;--- Remove protected libraries from selection list (hidden list)
      :Protected_libs
      ;--- look at last entry, if it's protected, decrease array size
      ^!If ^$StrIndex(^%PassLibs^%PassLibs0%%;1)$<>_ Skip ELSE ^!Dec %PassLibs0%
      ;--- no "_" means the remainder of the array is a keeper
      ^!Goto Protected_libs
      ;--- combine lists and offer for selection
      ^!SetArray %NewOnList%=^?{(T=A;H=25)CHECK to turn ON, Uncheck to turn
      OFF==^%ActvLibs%^%PassLibs%}
      ;--- First, hide ALL libraries,
      ^!SetFileAttr "^$GetLibraryPath$*.clb" H
      ;--- loop counter to "0" lets me place inc at top of loop
      ^!Set %ix%=0
      ;--- loop through selected libraries
      :loop
      ;--- INC at top makes bottom of loop a lot simpler
      ^!Inc %ix%
      ;--- UN-hide this file
      ^!SetFileAttr "^$GetLibraryPath$^%NewOnList^%ix%%" -H
      ;--- if not the last go to next file
      ^!If ^%ix%<^%NewOnList0% loop
      ;--- Pop to clipbook (if not there already)
      ^!SetFocus Clipbook
      ;--- Copy library name to clipboard
      ^!Keyboard Shift+Tab Ctrl+C Shift+Tab
      ;--- Set this name as default in wizard
      ^!Set %NewOnList%=^$SetDefaultValue(^%NewOnList%;^$GetClipboard$.clb)$
      ;--- choose default library from active list (default is current)
      ^!LoadLibrary ^?{(H=25)Choose the active library==^%NewOnList%}
      ;--- Force execution to continue, even if cancelled
      ^!IfCancel Next
      ;--- splash water in face, and in NoteTab's face. Youre done!
      ^!Refresh
      ;--- END OF CLIP


      BTW, I have left out such niceties as ^!SetWizard... because
      I like to keep my utilities lean and mean.


      Cheers,


      Eb
    • Show all 8 messages in this topic