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

Close then reopen

Expand Messages
  • Sezor
    Good day all. Can anyone suggest what s wrong with this 4.95 code, intended to close then reopen the current file? - ... ; close then reopen current file
    Message 1 of 6 , Sep 1, 2009
    View Source
    • 0 Attachment
      Good day all.
      Can anyone suggest what's wrong with this 4.95 code,
      intended to close then reopen the current file? -

      :R
      ; close then reopen current file
      ^!ClipBoardSave
      ^!Set %path%=^$GetPath(^**)$
      ^!Set %name%=^$GetFileName(^**)$
      ; ^!SetClipboard ^%name%
      ; ^!Info fpath is ^%path%^%name%
      ^!IfFalse ^$IsModified$ NoSave
      ; ^!Close Discard
      ; ^!Close "^%path%^%name%" Discard
      ^!Keyboard Ctrl+F4 &3000 n
      ^!Goto open

      :NoSave
      ^!Keyboard Ctrl+F4
      ^!Goto open

      :Open
      ; ^!Info fpath is ^%path%^%name%
      ; ^!Set %name%=^$GetClipBoard$
      ; ^!Info fpath is ^%path%^%name%
      ^!Wait
      ^!Open "^%path%^%name%"
      ^!ClipBoardRestore
      ^!Goto end

      Or suggest an alternative?

      If the file is not modified, it works ok. If it is, it can
      yield odd results - like a file called efo~33.otl
      containing the first topic of the file being closed
      which had no topic list in spite of the .otl extension.
      .
      It fails because it transforms the filename (whatever it
      is) into "efo~NN" - which, naturally, is not found. It seems to
      work better on smaller files (?).
      The path part gives no trouble.
      The commented out lines show things I've tried.
      Sezor

      PS I'm writing this clip because ntb 4.95 doesn't always
      recognize when an open file has been modified by another app.
      It also sometimes, when reloading a changed outline file,
      displays the topic list of one file alongside the text
      content of another.
      Has the new version fixed these hics?
    • ebbtidalflats
      In no particular order, 1. If you re trying to overcome NoteTab s failure to ecognize if a file has been modified by an external application, NoteTab functions
      Message 2 of 6 , Sep 1, 2009
      View Source
      • 0 Attachment
        In no particular order,

        1. If you're trying to overcome NoteTab's failure to ecognize
        if a file has been modified by an external application,
        NoteTab functions are unlikely to overcome this problem.

        One way to reliably detect if a file has changed against
        the open document is to check their CRC or MD5 signatures.
        Check the file, check the doc, compare the signatures
        against each other.

        fix that is to use the ARCHIVE bit (GetDosOutput).
        However, that will require you to keep track of the archive
        bit while editing yourself.

        2. Did later versions of NTP fix certain problems?
        Weeellllll, tracking, if a file has been modified,
        has a whole new twist -- at least in MY experience.
        Fookes holdings has not been able to help so far.

        a. First, reporting if an external app has changed a
        file is a problem with USB drives, which have a
        second order delay in writing (greater delay
        than on hard disks). So if you're using USB drives
        for data storage, Windows may be the problem.

        b. NTP 6.12 FREQUENTLY reports a library as modified
        externally, "do I want to reload?" when I KNOW it
        has not been modified. The problem lies in the
        many possible locations for library files
        Program Files/NoteTab/libraries
        ...\user\Application Data\NoteTab\libraries
        and wherever you designate on commandline

        I'm not sure if 6.12 tracks external changes properly,
        it seems

        c. Displaying the topic list of an outline file
        next to the content of a different document is
        still with us in ver 6.12

        This is ofcourse a "second window" problem.

        Despite these and other NoteTab anoyances, I found it well worth upgrading.


        Cheers,


        Eb


        --- In ntb-clips@yahoogroups.com, Sezor <sezor@...> wrote:
        >
        >
        > Good day all.
        > Can anyone suggest what's wrong with this 4.95 code,
        > intended to close then reopen the current file? -
        >
        > :R
        > ; close then reopen current file
        > ^!ClipBoardSave
        > ^!Set %path%=^$GetPath(^**)$
        > ^!Set %name%=^$GetFileName(^**)$
        > ; ^!SetClipboard ^%name%
        > ; ^!Info fpath is ^%path%^%name%
        > ^!IfFalse ^$IsModified$ NoSave
        > ; ^!Close Discard
        > ; ^!Close "^%path%^%name%" Discard
        > ^!Keyboard Ctrl+F4 &3000 n
        > ^!Goto open
        >
        > :NoSave
        > ^!Keyboard Ctrl+F4
        > ^!Goto open
        >
        > :Open
        > ; ^!Info fpath is ^%path%^%name%
        > ; ^!Set %name%=^$GetClipBoard$
        > ; ^!Info fpath is ^%path%^%name%
        > ^!Wait
        > ^!Open "^%path%^%name%"
        > ^!ClipBoardRestore
        > ^!Goto end
        >
        > Or suggest an alternative?
        >
        > If the file is not modified, it works ok. If it is, it can
        > yield odd results - like a file called efo~33.otl
        > containing the first topic of the file being closed
        > which had no topic list in spite of the .otl extension.
        > .
        > It fails because it transforms the filename (whatever it
        > is) into "efo~NN" - which, naturally, is not found. It seems to
        > work better on smaller files (?).
        > The path part gives no trouble.
        > The commented out lines show things I've tried.
        > Sezor
        >
        > PS I'm writing this clip because ntb 4.95 doesn't always
        > recognize when an open file has been modified by another app.
        > It also sometimes, when reloading a changed outline file,
        > displays the topic list of one file alongside the text
        > content of another.
        > Has the new version fixed these hics?
        >
      • Axel Berger
        ... I haven t yet come round to updating, but in my 5.8 I have never ever had a single problem with it noticing when a file was changed - works perfectly every
        Message 3 of 6 , Sep 1, 2009
        View Source
        • 0 Attachment
          ebbtidalflats wrote:
          > Despite these and other NoteTab anoyances, I found it
          > well worth upgrading.

          I haven't yet come round to updating, but in my 5.8 I have never ever
          had a single problem with it noticing when a file was changed - works
          perfectly every time. But I may not be doing the same things that you
          are and I never use USB as a working drive.

          Axel
        • loro
          ... What happens if you use ^## instead of ^**? I don t follow exactly what you want to do, but if it has to do with the file being altered by other programs,
          Message 4 of 6 , Sep 1, 2009
          View Source
          • 0 Attachment
            >If the file is not modified, it works ok. If it is, it can
            >yield odd results - like a file called efo~33.otl
            >containing the first topic of the file being closed
            >which had no topic list in spite of the .otl extension.
            >.
            >It fails because it transforms the filename (whatever it
            >is) into "efo~NN" - which, naturally, is not found.

            What happens if you use ^## instead of ^**? I don't follow exactly
            what you want to do, but if it has to do with the file being altered
            by other programs, maybe a '^!Menu Edit/Reload' would be a solution?

            Lotta
          • jonas_ramus
            ... Correct. If you change the :Open section of your clip to... ^!Wait ^!Info ^%path%^%name% you will see that NT is searching a temporary efo-file now which
            Message 5 of 6 , Sep 2, 2009
            View Source
            • 0 Attachment
              --- In ntb-clips@yahoogroups.com, Sezor <sezor@...> wrote:
              >
              > It fails because it transforms the filename (whatever it
              > is) into "efo~NN" - which, naturally, is not found.

              Correct. If you change the :Open section of your clip to...

              ^!Wait
              ^!Info ^%path%^%name%

              you will see that NT is searching a temporary efo-file now which is not to be found in the directory you have stored in your variable since it is saved in \Temp.

              Documents that have not been saved are stored in a temporary file when the token ^** is used. The temporary file is then substituted for the document name.

              Use ^## if you do not want NT to create a temporary file.

              Furthermore: ^## completely returns the file name and path of the active file. So there's no need to use that token with ^$GetPath$ and ^$GetFileName$.

              Probably, the core functions of your clip can be reduced to something like...

              ^!Set %File%=^##
              ^!Close Discard
              ^!Delay 10
              ^!Open ^%File%

              (Tested with NT Pro 6.12)

              Regards,
              Flo
            • Sezor
              Thanks for all the suggestions. I have to admit that I was writing a clip for an action which turns out to be available in the menus .. ;-( As I use keyboard
              Message 6 of 6 , Sep 2, 2009
              View Source
              • 0 Attachment
                Thanks for all the suggestions.
                I have to admit that I was writing a clip for an action
                which turns out to be available in the menus .. ;-(

                As I use keyboard shortcuts for almost everything,
                I had never spotted the Reload item. I even doubt if
                I've ever used the Edit menu.
                Sezor


                jonas_ramus wrote:
                >
                >
                > --- In ntb-clips@yahoogroups.com <mailto:ntb-clips%40yahoogroups.com>,
                > Sezor <sezor@...> wrote:
                > >
                > > It fails because it transforms the filename (whatever it
                > > is) into "efo~NN" - which, naturally, is not found.
                >
                > Correct. If you change the :Open section of your clip to...
                >
                > ^!Wait
                > ^!Info ^%path%^%name%
                >
                > you will see that NT is searching a temporary efo-file now which is not
                > to be found in the directory you have stored in your variable since it
                > is saved in \Temp.
                >
                > Documents that have not been saved are stored in a temporary file when
                > the token ^** is used. The temporary file is then substituted for the
                > document name.
                >
                > Use ^## if you do not want NT to create a temporary file.
                >
                > Furthermore: ^## completely returns the file name and path of the active
                > file. So there's no need to use that token with ^$GetPath$ and
                > ^$GetFileName$.
                >
                > Probably, the core functions of your clip can be reduced to something
                > like...
                >
                > ^!Set %File%=^##
                > ^!Close Discard
                > ^!Delay 10
                > ^!Open ^%File%
                >
                > (Tested with NT Pro 6.12)
                >
                > Regards,
                > Flo
                >
                >
              Your message has been successfully submitted and would be delivered to recipients shortly.