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

[Clip] Re: Get the current filename?

Expand Messages
  • brianj@ais.ais-gwd.com
    ... Oh, I m a Big Dummy. I guess you can t have anything before the function. I was tring to insert the current filename inside of a comment within some source
    Message 1 of 8 , Feb 8, 2000
    • 0 Attachment
      brian-@...-gwd.com wrote:

      > ^!KeyBoard Shift+F5

      Oh, I'm a Big Dummy.

      I guess you can't have anything before the function. I was
      tring to insert the current filename inside of a comment
      within some source code.

      Forget it, I have it working now. :-P

      (blush)

      Thanks, Charles -

      Brian
    • brianj@ais.ais-gwd.com
      brian-@ais.ais-gwd.com wrote: original article:http://www.egroups.com/group/ntb-clips/?start=2608 ... Well maybe not. I was testing it from my desktop. When I
      Message 2 of 8 , Feb 8, 2000
      • 0 Attachment
        brian-@...-gwd.com wrote:
        original article:http://www.egroups.com/group/ntb-clips/?start=2608
        > brian-@...-gwd.com wrote:
        >
        > > ^!KeyBoard Shift+F5
        >
        > Oh, I'm a Big Dummy.
        >
        > I guess you can't have anything before the function. I was
        > tring to insert the current filename inside of a comment
        > within some source code.
        >
        > Forget it, I have it working now. :-P

        Well maybe not. I was testing it from my desktop. When I tried it when
        the file was in a subdir of C:\ it displayed the path again.

        I give up. I gotta get back to work.

        Brian
      • Larry Thomas
        Hi Brian and Charles, ... You need to use both functions nested together to do it. ^!Info ^$GetFileName(^$GetDocName$)$ ^$GetDocName$ gives you the whole name
        Message 3 of 8 , Feb 8, 2000
        • 0 Attachment
          Hi Brian and Charles,

          At 11:30 AM 2/8/2000 -0800, you wrote:
          >"charles m. raine" <raine-@...> wrote:
          >
          >> Hi Brian:
          >>
          >> Yes there is:
          >>
          >> ^$GetFileName(FileName)$
          >>
          >> Returns the name and extension of FileName (without path).
          >
          >I forgot to mention that I tried that. That returns, literally,
          >FileName in my case. Because I was trying to skip having to enter a
          >file name, I was looking for something else (like Shift+F5 on the
          >keyboard).
          >
          >I also tried:
          >
          >^!KeyBoard Shift+F5
          >
          >..but that didn't work (it just printed ^!KeyBoard Shift+F5, rather
          >than the file name) :-(
          >
          >Any ideas how I can accomplish this?
          >
          >Gracias,
          >
          >Brian

          You need to use both functions nested together to do it.

          ^!Info ^$GetFileName(^$GetDocName$)$


          ^$GetDocName$ gives you the whole name with the path and drive letter, then
          ^$GetFileName(^$GetDocName$)$ leaves you with just the file name and the
          extension with all of the path/drive information stripped away.

          Regards,

          Larry
          larryt@...
        • Wayne VanWeerthuizen
          ... If I understand your intent, you are looking for: ^$GetFileName( ^** )$ Or possibly just: ^** ^** is the path, filename and extension for the current
          Message 4 of 8 , Feb 8, 2000
          • 0 Attachment
            brianj@...-gwd.com wrote:

            >"charles m. raine" <raine-@...> wrote:
            >
            >> Hi Brian:
            >>
            >> Yes there is:
            >>
            >> ^$GetFileName(FileName)$
            >>
            >> Returns the name and extension of FileName (without path).
            >
            >I forgot to mention that I tried that. That returns, literally,
            >FileName in my case. Because I was trying to skip having to enter a
            >file name, I was looking for something else (like Shift+F5 on the
            >keyboard).

            If I understand your intent, you are looking for:

            ^$GetFileName("^**")$

            Or possibly just:

            ^**

            ^** is the path, filename and extension for the current document,
            such as: C:\My Documents\MyFile.ext

            ^$GetName("C:\My Documents\MyFile.ext")$ extracts just the
            filename from the path and filename given to it. In this case
            it returns: MyFile

            ^$GetExt("C:\My Documents\MyFile.ext")$
            will return: .ext

            ^$GetPath("C:\My Documents\MyFile.ext")$
            will return: C:\My Documents\

            ^$GetFileName(File) returns both the filename and extension, so
            it is like ^$GetName(File)$ and ^$GetExt(File)$ combined.



            --
            Wayne M. VanWeerthuizen
            Homepage: http://landru.myhome.net/wayne
          • Jody
            Hi Brian, ... Along with what has been mentioned you can break it into sections. It is longer for what you need now, but here it is: ^$GetPath(^##)$
            Message 5 of 8 , Feb 8, 2000
            • 0 Attachment
              Hi Brian,

              > c:\path\to\file.c
              >
              > ..all I want to grab is the name file.c
              >
              > Anyway to do this?

              Along with what has been mentioned you can break it into
              sections. It is longer for what you need now, but here it is:

              ^$GetPath(^##)$
              ^$GetName(^##)$
              ^$GetExt(^##)$

              Or all in one like ^$GetDocName$:

              ^$GetPath(^##)$^$GetName(^##)$^$GetExt(^##)

              ^## Returns the full path.
              ^** Gets the temp path if the file is in an unsaved state.

              If you get Wayne's Cross Reference once you find one you can
              hyper jump to like commands and functions.

              H=Wayne's Notetab
              ^!Url http://landru.myhome.net/wayne/notetab.html

              H=Wayne's Reference
              ^!Url http://landru.myhome.net/wayne/ntr460.zip

              Happy Clip'n!
              Jody

              http://www.sureword.com/notetab

              Subscribe, UnSubscribe, Options
              mailto:Ntb-Clips-Subscribe@...
              mailto:Ntb-Clips-UnSubscribe@...
              http://www.egroups.com/list/ntb-clips
            Your message has been successfully submitted and would be delivered to recipients shortly.