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

Re: [Clip] ClipCode functionality in Templates

Expand Messages
  • hsavage
    ... user to ... functions ... name of ... instead ... script you ... the file ... Langis, I use templates extensively for building pages for a website I
    Message 1 of 10 , Apr 6, 2002
      > On 3/27/02 7:27 AM, gagnon.langis@... wrote:
      > There is an inconsistency in the use of the following clip functions in
      > conjunction with Template. I created a template which request the
      user to
      > enter the name for the file and then I try to invoke the following
      > to change the name assigned to the file upon opening the template:
      > ^!RenameDoc, ^$GetDocName$
      > The ^$GetDocName$ doeesn't return the name just assigned from the ` =
      > DocTemplate ClipCode "Script%0.3d.pl" ' as you would expect, but the
      name of
      > the Template File that was opened.
      > The ^!RenameDoc, changes the name of the Template File on the disk
      > of the name that appears on the tab in the active window.
      > The ^!Save As command works, but it saves the file without asking you for
      > the location of where to save it. Plus when you are testing this
      script you
      > do not really want to save the file, just control what the name of
      the file
      > will be if you decide to save it.
      > The best solution would be the ability to invoke a dialog asking for the
      > filename on opening the template.
      > Anybody has an idea on how to solve this problem?
      > Langis Gagnon
      > Team leader - Systems and Technology
      > Comptroller's Branch
      > Industry Canada
      > 235 Queen Street
      > Ottawa, Ontario
      > K1A 0H5
      > E-Mail: gagnon.langis@...
      > Phone: (613) 941-3842


      I use templates extensively for building pages for a website I
      maintain. I had the same problem you speak of (and several others) at

      Below is a sample clip that demonstrates my work-around.
      the ^!Set %fpath% line is the only long line you will need to fix after
      email wrapping.

      Below that is one of the several template/text files I use.

      1. I save the template as text file without the template header and it
      never changes.

      2. I set the variable path and name before the template/text is called.

      3. After step 2, I load the template/text

      4. Use the ^!InsertText command to insert the header line into the
      template/text file. At this point the inserted header will be in
      expanded form, will be the actual path and filename, eg.
      = DocTemplate ClipCode "D:\NTP\TemplateFileName.txt"^p^p^p

      5. Save the intermediate file as ^%fpath%^%fname% or ^%tplname%

      6. Use ^!KeyBoard command to reload template to perform other commands
      and equations contained in the template.

      7. After the reload, and after the clip commands and functions in the
      template have operated, save last time under the initially established


      ; Step 2 above -- set the variable path and name
      ^!Set %fpath%=^?{(t=d)Get Fpath=^$GetDocumentPath$}; %fname%=^?{Type
      ^!Set %tplname%=^%fpath%^%fname%
      ^!Info ^%tplname%
      ; Step 3 above -- Open template text
      ^!Open ^$GetTemplatePath$test.tpl
      ; Step 4 above -- insert template header at top of file
      ^!InsertText = DocTemplate ClipCode "^%tplname%"^p^p^p
      ; Step 5 above -- save intermediate file
      ; with expanded header
      ^!Save AS "^%tplname%"
      ; Step 6 above -- reload template
      ^!KeyBoard Alt+E R
      ; Step 7 above -- save the finished template output
      ^!Save AS "^%tplname%"

      several lines may get wrapped in email but this text is just there as
      an example.

      <!-- ///////// 3 Picture Table layout \\\\\\\\\ -->
      <P CLASS="breakhere">
      <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="3"

      <th colspan="2" align="center"><a href="javascript:window.close()">click
      any picture to close window!

      <td align="center" valign="middle">
      <a href="javascript:window.close()"><img src="^%index%_02.jpg"
      border="2" alt="Click back to index"></a>

      <td align="center" valign="middle">
      <a href="javascript:window.close()"><img src="^%index%_03.jpg"
      border="2" alt="Click back to index"></a>
      <br />
      <br />
    Your message has been successfully submitted and would be delivered to recipients shortly.