From: Reventlov on
Il giorno Mon, 6 Sep 2010 14:03:32 -0500, "Paul Randall" <paulr901(a)cableone.net> ha
scritto:
>Within a .HTA, you can have multiple sets of <script ... </script>
>elements. They can use any language that you have set up for scripting,
>like the M$ supplied VBScript and JScript, and Pearl, Python, Rex, and a
>bunch of others. All subprocedures (Functions, Subs, and whatever the
>syntax of the languages allow) are only executed when that subprocedure is
>called explicitly by your code or implicitly as part of event handling. All
>the code not withing subprocedure blocks is executed once only, and is
>executed in the order in which it appears withing the HTA. HTAs allow
>script blocks almost anywhere, even though the HTML standards don't.
>
>Here is an example. I suppose this might be useful as a debugging technique
>when building complex layouts.
>
><SCRIPT Language="VBScript">
>MsgBox "About to start the <html> ... </html> element"
></SCRIPT>
><html>
><head>
><title>Put your window title bar here</title>
><script language="vbscript">
>'Putting this script here prepositions the window.
>'Windowstate=Maximize would override this.
>Const wdDlg = 600, htDlg = 380 ' dialog size
>Const pxLeft = 100, pxTop = 100 ' positioning
> window.ResizeTo wdDlg,htDlg
> window.MoveTo pxLeft,pxTop
></SCRIPT>
><HTA:APPLICATION
> ID="Put your ID here"
> APPLICATIONNAME="Put your application name here"
> SCROLL="yes"
> SINGLEINSTANCE="no"
> WINDOWSTATE=""
>>
></head>
>
><SCRIPT Language="VBScript">
>MsgBox "Done with the <head> ... </head> element"
></SCRIPT>
><body>
><table width="100%" border>
> <tr>
> <td width="25%" valign="top">Row 1, Column 1</td>
> <td width="25%" valign="top">Row 1, Column 2</td>
> <td width="25%" valign="top">Row 1, Column 3</td>
> <td width="25%" valign="top">Row 1, Column 4</td>
> </tr>
></table>
><SCRIPT Language="VBScript">
>MsgBox "Done building table"
></SCRIPT>
><select size="3" name="Listbox1" onChange="RunScript">
><option value="1">Option 1</option>
><option value="2">Option 2</option>
><option value="3">Option 3</option>
><option value="4">Option 4</option>
></select>
><SCRIPT Language="VBScript">
>MsgBox "Done building listbox"
></SCRIPT>
>
></body>
><SCRIPT Language="VBScript">
>MsgBox "Done with the <body> ... </body> element"
></SCRIPT>
></html>
><SCRIPT Language="VBScript">
>MsgBox "Done with the <html> ... </html> element"
></SCRIPT>
>
>-Paul Randall

This is really interesting. It shows how and when the scripts are run in the hta.
Thank you.
Giovanni

--
Giovanni Cenati (Bergamo, Italy)
Write to "Reventlov" at katamail com
http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
--