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

ClipCode functionality in Templates

Expand Messages
  • gagnon.langis@ic.gc.ca
    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
    Message 1 of 10 , Mar 27 5:27 AM
    • 0 Attachment
      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 functions
      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 instead
      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
    • stephen riddle
      Hi Langis, I almost always run a little wizard asking these questions (providing default answeres, of course): Where do you want to save the document? What
      Message 2 of 10 , Mar 27 9:00 AM
      • 0 Attachment
        Hi Langis,

        I almost always run a little wizard asking these questions (providing default
        answeres, of course):
        Where do you want to save the document?
        What Name?
        What extension?
        I use the document information of the current document (^**) to get the
        information.
        Something like this (except different, of course):
        ^?!Set %newDocumentInfo%=^?{(T=D)Where do you want to save this
        document?=^$GetPath("^**")}^?{What Name?=^$GetFileName("^**")$^?{What
        extension=^$GetFileExt("^**")$
        Check the syntax and function names in your help files, I'm in another
        system now, and not able to check it very easily, but that gives you the
        basic idea.
        Then later just use the command:
        ^!Save AS ^%newDocumentInfo%
        and everything should be just hunky-dory.
        For testing, I tend to use temp.html, temp.text . . . on my desktop.
        I guess it would be even simpler to just do thie following and ignore all the
        above,
        Use the Save As command with a wee wizard:

        ^!SaveAs ^?{(T=S)Now where do you want to save this=^**}

        Good luck,
        Stephen
        On Wednesday 27 March 2002 05:27, you wrote:
        > There is an inconsistency in the use of the following clip functions in
        > conjunction with Template.
        > template: ^!RenameDoc, ^$GetDocName$
        >
        >
        > The ^!RenameDoc, changes the name of the Template File on the disk instead
        >
        > The ^!Save As command works, but it saves the file without asking you for
        > the location of where to save it.
      • Jody
        Hi Langis, ... ^!Save As was purposely made to force a save with no prompt. (You will find it to be a very good friend on down the road.;) Just use ^!Save. You
        Message 3 of 10 , Mar 27 9:48 PM
        • 0 Attachment
          Hi Langis,

          >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.

          ^!Save As was purposely made to force a save with no prompt.
          (You will find it to be a very good friend on down the road.;)
          Just use ^!Save. You have two main choices. The first is to
          prompt for the file name at Clip start and the second would be
          prompt for the name at any other point you would like. The
          difference is in the brackets and braces.

          Pops up as soon as the Clip is clicked on - processed first.
          ^!Save ^?[(T=S)Save as...]

          Pops up when it is its time in the line by line evaluation and/or
          execution
          ^!Save ^?{(T=S)Save as...}

          Happy Clip'n!
          Jody

          http://www.notetab.net

          Subscribe, UnSubscribe, Options
          mailto:Ntb-Clips-Subscribe@yahoogroups.com
          mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
          http://groups.yahoo.com/group/ntb-clips
        • gagnon.langis@ic.gc.ca
          When I use the ^!Save ^?[(T=S)Save as...] command, a dialog pops up asking me the name of the file etc..., it allows me to browse to where the folder should
          Message 4 of 10 , Mar 28 9:40 AM
          • 0 Attachment
            When I use the ^!Save ^?[(T=S)Save as...] command, a dialog pops up asking
            me the name of the file etc..., it allows me to browse to where the folder
            should be, but....

            If I browse to select the directory and then type in the file name and clic
            save, it returns me to the dialog generated by the ^!Save ^?[(T=S)Save
            as...] with the result of my selection entered in the input box, however,
            when I clic OK, the dialog disappear and nothing has happened, the file is
            not sved, the DocName has not changed.

            My question should have been simply, how can I create a template that upon
            opening it, a dialog appears asking me the name I want to give to the file
            and as a result, the file is not saved but the DocName is now the name I
            entered in the Dialog Box?

            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


            -----Original Message-----
            From: Jody [mailto:av1611@...]
            Sent: Thursday, March 28, 2002 12:49 AM
            To: ntb-clips@yahoogroups.com
            Subject: Re: [Clip] ClipCode functionality in Templates


            Hi Langis,

            >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.

            ^!Save As was purposely made to force a save with no prompt.
            (You will find it to be a very good friend on down the road.;)
            Just use ^!Save. You have two main choices. The first is to
            prompt for the file name at Clip start and the second would be
            prompt for the name at any other point you would like. The
            difference is in the brackets and braces.

            Pops up as soon as the Clip is clicked on - processed first.
            ^!Save ^?[(T=S)Save as...]

            Pops up when it is its time in the line by line evaluation and/or
            execution
            ^!Save ^?{(T=S)Save as...}

            Happy Clip'n!
            Jody

            http://www.notetab.net

            Subscribe, UnSubscribe, Options
            mailto:Ntb-Clips-Subscribe@yahoogroups.com
            mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
            http://groups.yahoo.com/group/ntb-clips





            Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
          • Alan C.
            Hi, ... I just tried to use a wizard (dialog) in the filename portion (a template s first line) of a template. (note that if using clip code in a template, as
            Message 5 of 10 , Mar 28 1:15 PM
            • 0 Attachment
              Hi,

              >My question should have been simply, how can I create a template that upon
              >opening it, a dialog appears asking me the name I want to give to the file
              >and as a result, the file is not saved but the DocName is now the name I
              >entered in the Dialog Box?

              I just tried to use a wizard (dialog) in the filename portion (a template's
              first line) of a template.

              (note that if using clip code in a template, as per Ntab help need clipcode
              in template's first line)

              And I couldn't get a wizard to work therein (first line). But a wizard
              (dialog) works fine for me when not located in the first line but instead
              located further down in the body of the template.

              Maybe I just didn't know proper way for wizard in template's first line.

              Or, if it turns out that a wizard is not supported in the first line of a
              template . . .

              then a clip could be written that when launched it would accomplish all of
              the following tasks: 1. for desired file name, present wizard (dialog) 2.
              edit the filename line of your template also saving it do disk 3. open
              such unique filename assigned template

              Maybe there's an easier way than (what follows, open a .txt edit & save as
              .tpl)

              Nonetheless, here's one idea:

              Not in a template, but in a clip:

              ; have your template info in a .txt file
              ; open such .txt file
              ; & edit & close saving changes
              ; save as with the .tpl at end of filename
              ; save as sample.tpl such lines of clip code here
              ^!Open "^$GetTemplatePath$sample.tpl"

              the above clip code lines would (with screen refresh off) edit and save
              changes to sample.tpl template as well as then (that last line there with
              the open command) opens the sample template. (but use your own test.tpl,
              not sample.tpl)

              Regards. Alan.
            • stephen riddle
              Hi Folks, Most people seem to have a wizard pop up like this (I use the curly braces, but it M I G H T work with square brackets) ^!Set
              Message 6 of 10 , Mar 28 4:55 PM
              • 0 Attachment
                Hi Folks,
                Most people seem to have a wizard pop up like this (I use the curly braces,
                but it M I G H T work with square brackets)
                ^!Set %outFileNameEtc%=^?{(T=D)Where do you want to save this}^?{What name?=}
                Run the template, code or whatever, and then run the Save As command with the
                OutFileName variable substituted

                ^!Save AS ^%outFileNameEtc%

                The only problem is if you have a file open identified as the same thing,
                then you have to do stuff manually.
                Tood Luck,
                Stp[kaing type]
              • Jody
                Hi Alan C., ... It use to be (or at least I cannot duplicate it) that at least one command (or I think just the ^! is enough) for a wizard to work. I m in Pro
                Message 7 of 10 , Mar 28 5:45 PM
                • 0 Attachment
                  Hi Alan C.,

                  >And I couldn't get a wizard to work therein (first line). But a
                  >wizard (dialog) works fine for me when not located in the first
                  >line but instead located further down in the body of the
                  >template.
                  >
                  >Maybe I just didn't know proper way for wizard in template's
                  >first line.
                  >
                  >Or, if it turns out that a wizard is not supported in the first
                  >line of a template . . .

                  It use to be (or at least I cannot duplicate it) that at least
                  one command (or I think just the ^! is enough) for a wizard to
                  work. I'm in Pro v4.86d beta.

                  Happy Clip'n!
                  Jody

                  http://www.notetab.net

                  Subscribe, UnSubscribe, Options
                  mailto:Ntb-Clips-Subscribe@yahoogroups.com
                  mailto:Ntb-Clips-UnSubscribe@yahoogroups.com
                  http://groups.yahoo.com/group/ntb-clips
                • Eric G.V. Fookes
                  Hello Langis, Sorry for my late reply on this issue... ... Templates are a special case. The creation of template-based documents is not completed until any
                  Message 8 of 10 , Mar 30 3:05 AM
                  • 0 Attachment
                    Hello Langis,

                    Sorry for my late reply on this issue...

                    >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 functions
                    >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 instead
                    >of the name that appears on the tab in the active window.

                    Templates are a special case. The creation of template-based documents is
                    not completed until any embedded code has finished being executed.
                    Processing the document name while the document is being created is indeed
                    unreliable.

                    >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.

                    If you specify a file name after the "^!Save As" command, NoteTab will not
                    prompt you to confirm that name. This is normal.


                    Regards,
                    Eric G.V. Fookes
                    Author of NoteTab, Mailbag Assistant, and Album Express
                    http://www.fookes.com/ and http://www.notetab.com/







                    ...
                  • Eric G.V. Fookes
                    Hello Alan, ... The header line in a template file only supports a limited number of Clip functions. See the Help file for the details. Regards, Eric G.V.
                    Message 9 of 10 , Mar 30 3:07 AM
                    • 0 Attachment
                      Hello Alan,

                      > >My question should have been simply, how can I create a template that upon
                      > >opening it, a dialog appears asking me the name I want to give to the file
                      > >and as a result, the file is not saved but the DocName is now the name I
                      > >entered in the Dialog Box?
                      >
                      >I just tried to use a wizard (dialog) in the filename portion (a template's
                      >first line) of a template.
                      >
                      >(note that if using clip code in a template, as per Ntab help need clipcode
                      >in template's first line)
                      >
                      >And I couldn't get a wizard to work therein (first line). But a wizard
                      >(dialog) works fine for me when not located in the first line but instead
                      >located further down in the body of the template.
                      >
                      >Maybe I just didn't know proper way for wizard in template's first line.

                      The header line in a template file only supports a limited number of Clip
                      functions. See the Help file for the details.


                      Regards,
                      Eric G.V. Fookes
                      Author of NoteTab, Mailbag Assistant, and Album Express
                      http://www.fookes.com/ and http://www.notetab.com/







                      ...
                    • hsavage
                      ... user to ... functions ... name of ... instead ... script you ... the file ... Langis, I use templates extensively for building pages for a website I
                      Message 10 of 10 , Apr 6, 2002
                      • 0 Attachment
                        > 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
                        functions
                        > 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
                        instead
                        > 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
                        >

                        Langis,

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

                        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
                        ^%tplname%.

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

                        H="TEST"
                        ^!Clearvariables
                        ;
                        ; Step 2 above -- set the variable path and name
                        ^!Set %fpath%=^?{(t=d)Get Fpath=^$GetDocumentPath$}; %fname%=^?{Type
                        Fname=test.doc}
                        ;
                        ^!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%"

                        --------------
                        SAMPLE TEMPLATE/TEXT FILE
                        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"
                        width="100%">

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

                        <tr>
                        <td align="center" valign="middle">
                        <a href="javascript:window.close()"><img src="^%index%_02.jpg"
                        width="^$Calc(^$GetImgWidth(^%fs_List%^%index%_02.jpg)$*.878;0)$"
                        height="^$Calc(^$GetImgHeight(^%fs_List%^%index%_02.jpg)$*.878;0)$"
                        border="2" alt="Click back to index"></a>
                        </td>

                        <td align="center" valign="middle">
                        <a href="javascript:window.close()"><img src="^%index%_03.jpg"
                        width="^$Calc(^$GetImgWidth(^%fs_List%^%index%_03.jpg)$*.878;0)$"
                        height="^$Calc(^$GetImgHeight(^%fs_List%^%index%_03.jpg)$*.878;0)$"
                        border="2" alt="Click back to index"></a>
                        </td>
                        </tr>
                        </table>
                        <br />
                        <br />
                      Your message has been successfully submitted and would be delivered to recipients shortly.