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

Converting url to file

Expand Messages
  • amitava_dg
    Hi I am trying to write a simplified version of the Script clip from the HTML Clipbook. My first attempt was as follows like so:
    Message 1 of 4 , Sep 7, 2010
    • 0 Attachment
      Hi
      I am trying to write a simplified version of the Script clip from the HTML Clipbook. My first attempt was as follows like so:
      ================================================================
      ^!SetWizardLabel "Enter values for tag attributes"
      ^!InsertWizardHtml <SCRIPT TYPE="^?{&Type script=_text/javascript|text/jscript|text/vbscript}" SRC="^?{&URL of script code}">^P<!--^P ^&^P//-->^P</SCRIPT>^P
      ================================================================

      That yielded a typical result as follows:
      ================================================================
      <script type="text/javascript" src="js/jquery-1.4.2.js">
      <!--

      //-->
      </script>
      ================================================================

      So far so good, but then I changed the input field for "SRC" to a browse field (^?[(T=O)&URL of script code=]), and got the following result which is, obviously not suitable.
      ================================================================
      <script type="text/javascript" src="E:\htdocs\testing\js\jquery-1.4.2.js">
      <!--

      //-->
      </script>
      ================================================================
      I could change the source field by hand, but is there a way to convert "E:\htdocs\testing\js\jquery-1.4.2.js" to "js/jquery-1.4.2.js" inside the clip?

      As always you need to watch out for wrapping of long lines.

      Thanks

      Amitava
    • loro
      ... You need ^$FileToUrl()$ and ^$GetRelativeName()$ . Lotta.
      Message 2 of 4 , Sep 7, 2010
      • 0 Attachment
        amitava_dg wrote:
        >So far so good, but then I changed the input field for "SRC" to a
        >browse field (^?[(T=O)&URL of script code=]), and got the following
        >result which is, obviously not suitable.
        >================================================================
        > <script type="text/javascript" src="E:\htdocs\testing\js\jquery-1.4.2.js">
        > <!--
        >
        > //-->
        > </script>
        >================================================================
        >I could change the source field by hand, but is there a way to
        >convert "E:\htdocs\testing\js\jquery-1.4.2.js" to
        >"js/jquery-1.4.2.js" inside the clip?

        You need ^$FileToUrl()$ and ^$GetRelativeName()$ .

        Lotta.
      • Amitava Das Gupta
        ... You need ^$FileToUrl()$ and ^$GetRelativeName()$ . Lotta. Thanks, but could you include an example or two? I tried both and while ^$GetRelativeName()$
        Message 3 of 4 , Sep 9, 2010
        • 0 Attachment
          amitava_dg wrote:
          >So far so good, but then I changed the input field for "SRC" to a
          >browse field (^?[(T=O)&URL of script code=]), and got the following
          >result which is, obviously not suitable.
          >================================================================
          > <script type="text/javascript" src="E:\htdocs\testing\js\jquery-1.4.2.js">
          > <!--
          >
          > //-->
          > </script>
          >================================================================
          >I could change the source field by hand, but is there a way to
          >convert "E:\htdocs\testing\js\jquery-1.4.2.js" to
          >"js/jquery-1.4.2.js" inside the clip?

          You need ^$FileToUrl()$ and ^$GetRelativeName()$ .

          Lotta.

          Thanks, but could you include an example or two? I tried both and while
          ^$GetRelativeName()$ works, I cannot get ^$FileToUrl()$ to work at all. If I
          use "^!Set %url%=^$FileToUrl(^?{(T=O)&URL of script code=})$" for instance,
          it seems to have no effect.

          Amitava




          ----------
          NEW Zoner Photo Studio Free - one free program for everything you do with your pictures - free.zoner.com


          [Non-text portions of this message have been removed]
        • loro
          ... It seems it screws up when you use curly braces in the wizard inside the function. Probably because wizards with square brackets are processed first in a
          Message 4 of 4 , Sep 10, 2010
          • 0 Attachment
            At 05:23 2010-09-10, Amitava Das Gupta wrote:
            >Thanks, but could you include an example or two? I tried both and while
            >^$GetRelativeName()$ works, I cannot get ^$FileToUrl()$ to work at all. If I
            >use "^!Set %url%=^$FileToUrl(^?{(T=O)&URL of script code=})$" for instance,
            >it seems to have no effect.

            It seems it screws up when you use curly braces in the wizard inside
            the function. Probably because wizards with square brackets are
            processed first in a clip, but the curly ones as they are
            encountered, i.e. too late in this case. Anyway, it works with square brackets.

            ^!Set %url%=^$FileToUrl("^$GetRelativeName(^?[(T=O)&URL of script code=])$")$

            If you split it up, either way works and it's easier to read.

            ^!Set %url%=^?{(T=O)&URL of script code=}
            ^!Set %url%=^$GetRelativeName(^$FileToUrl("^%url%")$)$

            Note that you need quotes with ^$FileToUrl()$ but not with
            ^$GetRelativeName()$ .

            Lotta
          Your message has been successfully submitted and would be delivered to recipients shortly.