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

Re: how to get name of current folder?

Expand Messages
  • frascinella
    Hugo, That little routine did the trick. Thank you very much. I read the online help for each function and figured out how they worked from your usage. Where
    Message 1 of 3 , Sep 22, 2004
    • 0 Attachment
      Hugo,

      That little routine did the trick. Thank you very much.

      I read the online help for each function and figured out how they
      worked from your usage. Where did you learn that putting ^** in
      $getpath()$ (resulting in the ^$getpath(^**)$ statement) would store
      the path to the current file?

      The online help for all these functions is in desperate need of
      realistic examples and more detail.

      Here is the file clip. Below the clip is the page fragment that the
      clip revises.

      ===========================
      H="Fix Printable version"
      ; 9-3-04 - new - replaces text with current file name
      ; 9-22-04 - added code to insert correct folder name
      ^!Jump doc_start
      ^!Find "printable version" I
      ^!IfError End
      ^!Select 0
      ^!Jump +7
      ^!Jump -7
      ^!Find "/hpccn/" I
      ^!IfError End
      ^!Select 0
      ^!Find "enter name of this page" IS
      ^!IfError Empty
      ^!Goto Continue

      :Empty
      ^!Info Found the Printable Version section but not the placeholder
      text.^PVerify that the link points to ^$GetFileName(^$GetDocName$)$
      in the correct folder.
      ^!Goto End

      :Continue
      ^!Jump +3
      ^!Jump -3
      ^!Find "enter name of this page" IS
      ^!Continue Get ready to replace this placeholder text with the
      current file name.
      ^!InsertText ^$GetFileName(^$GetDocName$)$
      ^!Find "hpccn/" IB
      ^!Jump select_end

      ; store the full path of the current file
      ^!Set %Folder%=^$getpath(^**)$

      ; delete one character from the right end, the slash
      ^!Set %Folder%=^$StrDeleteRight("^%Folder%";1)$

      ; locate the position of the last backslash by starting from the
      right side
      ^!Set %LastBacklash%=^$StrPosRight("\";"^%Folder%";0)$

      ; delete text from start of string to position of last backslash
      ^!Set %Folder%=^$StrDeleteLeft("^%Folder%";^%LastBacklash%)$

      ; test the folder name; if it is not hpccn_NEW, then inserting it
      ^!If ^%Folder% = "hpccn_NEW" END ELSE insert

      :insert
      ^!InsertText ^%Folder%/
      ^!Info Make sure this file path matches what is on the server.

      :END
      ========================
      web page fragment:

      <!-- Begin Printable Version -->
      <table border="0" cellpadding="0" cellspacing="0" width="740">
      <tr>
      <td align="center" valign="bottom" width="170" bgcolor="#F0F0F0"><img
      src="http://welcome.hp-ww.com/img/hpweb_1-2_prnt_icn.gif" width="19"
      height="13" alt="" border="0"><a href="http://www.hp.com/cgi-bin/pf-
      new.cgi?IN=http://www.hp.com/techservers/hpccn/sci_vis/enter name of
      this page" class="udrlinebold">Printable version</a></td>
      <td width="10"></td>
      </tr>
      </table>

      ====================
      --- In ntb-clips@yahoogroups.com, "Hugo Paulissen"
      <hugopaulissen@s...> wrote:
      > But I could
      > > not find any function that stored the current file's folder name.
      > DOes anyone
      > > know if NoteTab has such a fiunction?
      > >
      > Hi Michael,
      >
      > If ^$GetPath$ is not what you want, you can manipulate the string
      to
      > get the name only...
      >
      > ^!Set %CrntFldr%=^$getpath(^**)$
      > ^!Set %CrntFldr%=^$StrDeleteRight("^%CrntFldr%";1)$
      > ^!Set %ChopAt%=^$StrPosRight("\";"^%CrntFldr%";0)$
      > ^!Set %CrntFldr%=^$StrDeleteLeft("^%CrntFldr%";^%ChopAt%)$
      > ^!INFO ^%CrntFldr%
      >
      > Hugo
    Your message has been successfully submitted and would be delivered to recipients shortly.