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

[Clip] Looking for a better way to switch files than this

Expand Messages
  • Forrest
    This works, but there must be a better way. In fact I tried a few better ones but got anomalous results (array elements turning blank for no apparent reason,
    Message 1 of 5 , Jun 5, 1999
    • 0 Attachment
      This works, but there must be a better way. In fact I tried a few better
      ones but got anomalous results (array elements turning blank for no apparent
      reason, etc.).

      There's probably a built in feature to do it. :/

      gf
      ;go to file without the mouse via autoreplace
      ;First make a list of all open docs
      ^!Set %num%=1
      ^!Set %docs%=^$GetDocName(^%num%)$
      ^!IF ^%num% < ^$GetDocCount$ GetNext ELSE Out
      :GetNext
      ^!Inc %num%
      ^!Append %docs%="|"
      ^!Append %docs%=^$GetDocName(^%num%)$
      ^!IF ^%num% <= ^$GetDocCount$ GetNext
      :Out
      ;display dialog to select one
      ^!Set %Id%=^?{(H=30)Select==^%docs%}
      :Loop
      ;find it and select it
      ^!SetDocIndex ^%num%
      ^!IF ^%Id% = ^$GetDocName$ End
      ^!Dec %num%
      ^!GoTo Loop



      ------------------------------------------------------------------------

      eGroups.com home: http://www.egroups.com/group/ntb-clips
      http://www.egroups.com - Simplifying group communications
    • Jody
      Hi Forrest, ... Nice clip and great idea for when working with large amount of docs - *especially* when switching back and forth to the clip editor and when
      Message 2 of 5 , Jun 6, 1999
      • 0 Attachment
        Hi Forrest,

        >This works, but there must be a better way.

        Nice clip and great idea for when working with large amount of
        docs - *especially* when switching back and forth to the clip
        editor and when you do not want to stack tabs (or cannot due
        to the amount of open docs).

        I added the notes of changes and additions right in the script.
        I used a different method to get to the doc instead of looping
        through each one which took quite some time.

        H=SetDocIndex...
        ; gf, modified by Jody, 06-06-1999
        ; Added for slower machines - makes up to 600%
        ; faster by disabling status bar while script
        ; is running (NoteTab Pro only)
        ^!SetHintInfo Getting document names...

        ; go to file without the mouse via autoreplace
        ; First make a list of all open docs
        ; Counter type variables set to zero since they
        ; are incremented before being used.
        ^!Set %num%=0; %nDex%=0
        ^!Set %docs%=^$GetDocName(^%num%)$

        ; If no new files were opened, the list is not rebuilt.
        ; This does not count if docs were closed. I think it
        ; is best to take it out and just rebuild the list
        ; every time which is pretty quick.
        ^!IF ^%num% < ^$GetDocCount$ GetNext ELSE Out

        :GetNext
        ; Increments the numbers used for the DocIndexes
        ^!Inc %num%

        ; Number seen in the list dialog box and used by the script
        ^!Inc %nDex%

        ; Adds the DocIndex number in front of the full name
        ; and vertical bar after them used in the dialog made
        ^!Append %docs%=^%nDex%: ^$GetDocName(^%num%)$|

        ; Loops till the last document has been added
        ^!IF ^%num% < ^$GetDocCount$ GetNext

        :Out
        ; Deletes last vertical bar just for the fun of it. :-)
        ^!Set %docs%=^$StrDelete("^%docs%";^$StrSize("^%docs%")$;1)$

        ; display dialog to select one. Changed H=30 to 28
        ; for smaller displays to keep from getting double
        ; scrollbars.
        ^!Set %Id%=^?{(H=28)Select==^%docs%}

        ; FocusDoc by getting the exact DocIndex number from
        ; the list. Uses the semi-colon to see how many
        ; digits are in the number.
        ^!IfDiff "^$StrCopy("^%Id%";2;1)$" ":" Skip_2
        ^!SetDocIndex ^$StrCopy("^%Id%";1;1)$
        ^!Goto End

        ^!IfDiff "^$StrCopy("^%Id%";3;1)$" ":" Skip_2
        ^!SetDocIndex ^$StrCopy("^%Id%";1;2)$
        ^!Goto End

        ^!IfDiff "^$StrCopy("^%Id%";4;1)$" ":" Skip_2
        ^!SetDocIndex ^$StrCopy("^%Id%";1;3)$

        ; Only good for up to 999 open documents. Continue
        ; pattern for more.


        Happy NoteTabbin',
        Jody Adair

        The NoteTabbers Assistant Page
        http://www.sureword.com/notetab
        NoteTab Home Page - Go Pro.....
        http://www.notetab.com

        ------------------------------------------------------------------------

        eGroups.com home: http://www.egroups.com/group/ntb-clips
        http://www.egroups.com - Simplifying group communications
      • Jody
        Hi Forrest, ^!Set %docs%=^$GetDocName(^%num%)$ ^!IF ^%num%
        Message 3 of 5 , Jun 6, 1999
        • 0 Attachment
          Hi Forrest,

          ^!Set %docs%=^$GetDocName(^%num%)$
          ^!IF ^%num% < ^$GetDocCount$ GetNext ELSE Out

          I got to looking at that and don't understand why you had it in
          there at all? It wasn't doing what I was thinking anyway.

          You originally had ^%num% <= the amount of docs open. The only
          time it would ever go to the out label would be when one doc was
          open and then it does not matter if the loop runs or not. Why
          somebody would want to use it for one document I do not know. :)
          Anyhow, here it is without all the comments:

          H=Switch2Doc nnn
          ; gf, modified by Jody, 06-07-1999
          ^!SetHintInfo Getting names and numbers...
          ^!Set %num%=0; %nDex%=0; %docs%=^%Empty%

          ^!Inc %num%
          ^!Inc %nDex%
          ^!Append %docs%=^%nDex%: ^$GetDocName(^%num%)$|
          ^!IF ^%num% < ^$GetDocCount$ Skip_-3
          ^!Set %docs%=^$StrDelete("^%docs%";^$StrSize("^%docs%")$;1)$

          ^!Set %Id%=^?{(H=28)Select==^%docs%}

          ^!IfDiff "^$StrCopy("^%Id%";2;1)$" ":" Skip_2
          ^!SetDocIndex ^$StrCopy("^%Id%";1;1)$
          ^!Goto End
          ^!IfDiff "^$StrCopy("^%Id%";3;1)$" ":" Skip_2
          ^!SetDocIndex ^$StrCopy("^%Id%";1;2)$
          ^!Goto End
          ^!IfDiff "^$StrCopy("^%Id%";4;1)$" ":" Skip_2
          ^!SetDocIndex ^$StrCopy("^%Id%";1;3)$

          Happy NoteTabbin',
          Jody Adair

          The NoteTabbers Assistant Page
          http://www.sureword.com/notetab
          NoteTab Home Page - Go Pro.....
          http://www.notetab.com

          ------------------------------------------------------------------------

          eGroups.com home: http://www.egroups.com/group/ntb-clips
          http://www.egroups.com - Simplifying group communications
        • Forrest
          ... From: Jody To: Sent: Sunday, June 06, 1999 9:10 PM Subject: [Clip] Re: Looking for a better way to switch files
          Message 4 of 5 , Jun 7, 1999
          • 0 Attachment
            ----- Original Message -----
            From: Jody <kjb1611@...>
            To: <ntb-clips@egroups.com>
            Sent: Sunday, June 06, 1999 9:10 PM
            Subject: [Clip] Re: Looking for a better way to switch files than this


            > Nice clip and great idea for when working with large amount of
            > docs - *especially* when switching back and forth to the clip
            > editor and when you do not want to stack tabs (or cannot due
            > to the amount of open docs).

            It is handy -- borrowed from the good old days of 8 bit software.* "Type
            number, or use arrows, then press Return." The modern list box doesn't seem
            to want to accept "14" to go to file 14, more's the pity...takes me to 1 then
            4.

            > ^!Set %docs%=^$GetDocName(^%num%)$
            > ^!IF ^%num% < ^$GetDocCount$ GetNext ELSE Out
            >
            > I got to looking at that and don't understand why you had it in
            > there at all? It wasn't doing what I was thinking anyway.

            At the time I didn't know how to delete the final "|" from the string, so had
            to construct the string differently -- start with "Name1" and add blocks of
            "|NameN" rather start with nothing and add blocks of "NameN|". I figured I
            had to avoid the loop if appropriate when using that method...although it
            would be a better idea to just exit if there was only one document.

            Thanks much for the changes. Now all I need is a better way to hot-key it
            than using autoreplace...!

            --
            * I still miss Appleworks (no relation to current product of same name).


            ------------------------------------------------------------------------

            eGroups.com home: http://www.egroups.com/group/ntb-clips
            http://www.egroups.com - Simplifying group communications
          • Jody
            Hi Forrest, ... Maybe we ll get lucky and get it in the Gold. Hot-keys sure would be nice! I m pretty sure we will have a configurable toolbar that we will
            Message 5 of 5 , Jun 7, 1999
            • 0 Attachment
              Hi Forrest,

              > Thanks much for the changes. Now all I need is a better way to
              > hot-key it than using autoreplace...!

              Maybe we'll get lucky and get it in the Gold. Hot-keys sure would
              be nice! I'm pretty sure we will have a configurable toolbar that
              we will be able to assign clips to so that would work and maybe Eric
              could nake it so we added our own hotkeys to the tools we made.

              Imagine, hotkey your favorite clip from anywhere in Windows. :) It
              would open up a whole new world for us!

              Happy NoteTabbin',
              Jody Adair

              The NoteTabbers Assistant Page
              http://www.sureword.com/notetab
              NoteTab Home Page - Go Pro.....
              http://www.notetab.com

              ------------------------------------------------------------------------

              eGroups.com home: http://www.egroups.com/group/ntb-clips
              http://www.egroups.com - Simplifying group communications
            Your message has been successfully submitted and would be delivered to recipients shortly.