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

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

Expand Messages
  • Larry Thomas
    Hi Eb, ^!SetIniFile ;without a file name this sets the default to Notepro.ini ^!ProgIniSave ^!Set %LibraryName%=$GetValue(Clipbook:DefaultLibrary)$
    Message 1 of 8 , Sep 1, 2000
      Hi Eb,

      ^!SetIniFile
      ;without a file name this sets the default to Notepro.ini
      ^!ProgIniSave
      ^!Set %LibraryName%=$GetValue(Clipbook:DefaultLibrary)$
      ^!SetIniFile Small.ini
      ;switches the ini to the small one you want
      ^!SaveValue Clipbook:DefaultLibrary=^%LibraryName%
      ^!ProgIniLoad

      You could also replace the last command (^!ProgIniLoad) with:

      ^!Loadlibrary ^%LibraryName%

      Or:

      ^!Loadlibrary ^$GetValue(Clipbook:DefaultLibrary)$

      I do see that I have a typo above in that
      $GetValue(Clipbook:DefaultLibrary)$ is missing a circumflex at the beginning.

      Regards,

      Larry
      larryt@...
    • Eb Guenther
      Hi Larry, Jody, Thanks for your comments and solutions. Since my first post on this subject another problem has shown up. The clip I m working on presents a
      Message 2 of 8 , Sep 2, 2000
        Hi Larry, Jody,

        Thanks for your comments and solutions.

        Since my first post on this subject another problem has shown up.

        The clip I'm working on presents a checklist of active (checked) and
        inactive (unchecked) libraries from which to select the new active list.
        A second wizard presents the new active list for chosing the new default
        library. My previous problem was about highlighting the current library as
        default in this second wizard.

        Now I realized that if I remove the current lib from active duty, it will
        disappear from the wizard, and cannot be set as default anyway. Even so I
        might want to keep that library as current. The only way to do that is not
        to select a different library. In other words, CANCEL out of the wizard.

        So, I'll just leave the clip as is -- no default lib (or maybe add a "Kepp
        Existing" choice). I will continue to cancel out of the wizard to chose
        the current library

        Thanks for your efforts guys. I did learn from your suggestions, even if I
        cannot go this route at this time.


        Eb
      • Jody
        Hi Eb and Larry, ... I don t know exactly what you are doing, but perhaps you can use: ^$GetDefaultValue(ValueList)$ (added in v4.6)
        Message 3 of 8 , Sep 2, 2000
          Hi Eb and Larry,

          >The clip I'm working on presents a checklist of active (checked)
          >and inactive (unchecked) libraries from which to select the new
          >active list. A second wizard presents the new active list for
          >chosing the new default library. My previous problem was about
          >highlighting the current library as default in this second
          >wizard.

          I don't know exactly what you are doing, but perhaps you can use:

          ^$GetDefaultValue(ValueList)$ (added in v4.6)
          ^$SetDefaultValue(ValueList;DefaultValue)$ (added in v4.6)

          There is an example Clip in SampleCode: Remember default value

          >Now I realized that if I remove the current lib from active duty,

          Did you enlist your Libraries into the Army? :) Or, were you one of
          those Wingnuts>:?รพ~~~~

          Happy Clip'n!
          Jody

          http://www.sureword.com/notetab

          Subscribe, UnSubscribe, Options
          mailto:Ntb-Clips-Subscribe@...
          mailto:Ntb-Clips-UnSubscribe@...
          http://www.egroups.com/group/ntb-clips
        • Eb Guenther
          Hi Jody, Larry, ... 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
          Message 4 of 8 , Sep 3, 2000
            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
          • Jody
            Hi Eb, ... Perhaps you missed my post about ^$SetDefaultValue(...)$ with an example in the SampleCode Library. Here it is with the default Libraries. I just
            Message 5 of 8 , Sep 3, 2000
              Hi Eb,

              >>I don't know exactly what you are doing,
              >
              >Me neither, ain't it exciting?!

              Perhaps you missed my post about ^$SetDefaultValue(...)$ with an
              example in the SampleCode Library. Here it is with the default
              Libraries. I just copied them from a Clip I use that anybody can
              get from my Libraries page to make real quick Library managers
              for the Clipbar (or just use as Clips). I use check boxes to
              either open/close All or selected Libraries. It is a no-brainer
              for anybody to make their own with in just a few clicks.

              http://www.sureword.com/notetab/zip/libtoggle.zip

              We have ^$GetFiles(...)$ also if you don't like DOS and will
              help prevent error like I got when running your Clip. Your's
              won't run on machines that need cmd.exe instead of command.com
              like we discussed not too long ago.

              Here is one I have in my LibToggle along with the first part of a
              work-around for Libraries starting with a "_" to prevent them
              from becoming a default (checked):

              ^!Set %AllLibraries%=^$GetFiles("^$GetLibraryPath$";*.clb;Name)$
              ^!Set %Libraries%=^$StrReplace("^$GetLibraryPath$";;"^%AllLibraries%";0;0)$
              ^!Set %Libraries%=^$StrReplace("_";"__";"^%Libraries%";0;0)$
              ^!Set %Libraries%=^$StrReplace(".clb";;"^%Libraries%";0;0)$

              This is how your remember the last used item in a wizard. You
              can do away with my keyboard thing or any ini file settings just
              by modifying your Clip a bit.

              H=Remember default value
              ;Create a new document
              ; ^!ToolBar New Document

              ;If the variable ValueList is not empty, skip the next instruction
              ^!IfFalse ^$IsEmpty(^%ValueList%)$ Skip
              ;Assign a list of values to the variable ValueList
              ^!Set %ValueList%=All|AutoCorrect|CaptureLinks|Euro|FormatEmail|FTP|_HTML|HTML-ar|PasteClips|RemindMe|SampleCode|Smilies|TxTPrint|TopStyle|Utilities

              ;Beginning of loop
              :StartLoop
              ;Promp user to select a value from the list in the Clip wizard
              ^!Set %DefaultValue%=^?{Choose or enter a new default value=^%ValueList%}
              ;Insert the chosen value in the document, followed by a line break
              ^!SetPasteIndent Off
              ^!InsertText Default value = ^%DefaultValue%^p
              ;Change the default-value marker to match the item chosen by the user
              ^!Set %ValueList%=^$SetDefaultValue(^%ValueList%;^%DefaultValue%)$
              ;Prompt user to continue or end Clip
              ^!Continue Continue demonstration?
              ;Jump back to the start of the loop
              ^!Goto StartLoop


              Happy Clip'n!
              Jody

              http://www.sureword.com/notetab

              Subscribe, UnSubscribe, Options
              mailto:Ntb-Clips-Subscribe@...
              mailto:Ntb-Clips-UnSubscribe@...
              http://www.egroups.com/group/ntb-clips
            • Eb Guenther
              Hi Jody, and Larry, My clip may not have run properly because of a long line split. There should only be a SINGLE LINE betweeen each pair of ;--- comment
              Message 6 of 8 , Sep 4, 2000
                Hi Jody, and Larry,

                My clip may not have run properly because of a long line split.
                There should only be a SINGLE LINE betweeen each pair of
                ";--- comment" lines

                When push comes to shove, I like small compact code. So I've
                reverted to a single wizard to pick libraries for the button bar,
                and defaulting to the previous library, which may or may not be
                hidden.

                If you are still interested in seeing what the clip does in the
                remaining 17 lines of code, make sure you are not splitting long
                lines and delete the 11 (eleven) lines at the end of the clip
                between (but not including):

                ^!If ^%ix%<^%NewOnList0% loop

                and

                ^!Refresh
                ;--- END OF CLIP


                The long discussion was informative on several fronts, but I'm
                going to have to move on.

                Thanks for all your suggestions.


                Cheers,

                Eb
              Your message has been successfully submitted and would be delivered to recipients shortly.