• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 400
  • Last Modified:

encoding HTC behaviors with scripting encoder

This question probably doesn't have a solution..
btw a workaround would be magic.
Is there any way to use Microsoft Scripting Encoder (currently in version 1.0)
to encode HTC files aka behaviors developed using a scripting language?
 
0
adedonatis
Asked:
adedonatis
  • 3
  • 2
1 Solution
 
clockwatcherCommented:
Why can't you do it?  I don't have IE5.0 available here, but can't you just set the language to VBScript.Encode and encode your htc files.  Your .HTCs are, of course, going to be IE5 only, and I believe the v5.0 scripting engines included with IE 5.0 should support VBScript.Encode as the language.

I'll try to get to an IE5 installation and test it out.

BTW, 1000 points seems like an awful lot of points for this question.  Was it a mistake?  If it was, you should probably delete it and repost it with a lower point value before someone tries to lock it in.
0
 
clockwatcherCommented:
Just got around to an IE5 installation and it works no problem.

Simply rename your htc file to an htm.  Run the script encoder on it and rename it back to an htc.

I encoded the following UL.HTC script from MSDN
(http://msdn.microsoft.com/workshop/essentials/versions/IE5behave.asp)

Original script renamed to ul.htm and added encoding flag:

<script language="jscript">
//**Start Encode**

attachEvent("onclick", event_onclick);

function event_onclick()
{
   var i;
   var style;

   if (event.srcElement != element)
      return;

   for (i = 0; i < children.length; i++)
   {
       style = children[i].style;
       if (style.display == "none")
       {
           style.display = "";
       }
       else
       {
           style.display = "none";
       }
   }
}

</script>

Script encoding commands:

  screnc ul.htm ul-encode.htm
  rename ul-encode.htm ul-encode.htc


And here's the final ul-encode.htc:

<script language="JScript.Encode">
//**Start Encode**#@~^zgEAAA==@#@&@#@&mYDlm427nxD`EW      msr13JB~+7+xDmGx1VbmV#I@#@&@#@&0!UmDkGU,+\nUD{Gx1sbmVv#@#@&      @#@&,~P7l.Pbi@#@&,PP7CD,/YHsni@#@&@#@&~P~r6Pc+7nxDRd.12VnhxOPex,+s:xY*@#@&~P,P~PM+O;Mxi@#@&@#@&PP,WGD,`bPxPTI,k~@!,^tbV[.xRsn      oOtp~b_Q*@#@&PP,      @#@&P,P~P,PdOHV+,xP1tk^[.+      $bT /Oz^+I@#@&~P,P~~,k0~ckYzV 9kdaVmXP{',ExKxnJ*@#@&~,PP,~PP@#@&,~~P,P,P~P~dDXs+c[kkwsCHP'~Eri@#@&,~,P~,P)@#@&,P,~P,PnVk+@#@&,PP,~P,      @#@&~~P,P,P~P~~kYzV Nb/2smXPx~rxGxEp@#@&,P,PP,P)@#@&,P~8@#@&N@#@&@#@&I2sAAA==^#~@</script>

And finally here's the page that uses the behavior.

<html>
<head>
<TITLE>UL with Behavior</TITLE>
<STYLE>
..LIST{behavior:url(ul-encode.htc);}
</STYLE>
</head>

<body>
<p>This is an example
  of an expanding/collapsing list
  using DHTML Behaviors

<ul class="LIST" style="cursor: hand;"
  title="Click to toggle the List">
  This is an unordered list
  which has a behavior attached to the ul.
<li> Item 1
<li> Item 2
<li> Item 3
<li> Item 4
</ul>
</BODY>
</html>

Works fine for me with no problems.  BTW as I mentioned earlier, 1000 points is way too high for this question.  If you'd like to delete it and repost a 100 point question for me, that would be fine.  I won't answer the question, so you should be free to delete it, but please don't screw me over by not reposting another question for me.
0
 
adedonatisAuthor Commented:
Dear clockwatcher this is a 1000 point question because the time can influence the price more than the complexity.
I will make a few tests on your solution and don't worry, If it works u will get 1000 points as deserved.

Thank you.

(BTW: I don't post a lot of questions so I can afford such an expense of points to have a quick answer).

0
 
adedonatisAuthor Commented:
Dear clockwatcher,

your solution it is excellent.
It is simple but very effective, I should have imagined it, but I didn't.
Please lock the question so I can give u the points.

Thank You.

0
 
clockwatcherCommented:
Thank you.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now