From: Paul Randall on

"Reventlov" <noone(a)no.void> wrote in message
news:4c7d0df5.2369625(a)powernews.libero.it...
> Hello,
> I'm writing this hta to transform values between km, m, hm, etc (but also
> litres, kg,
> square metres)
>
> In the window_onload sub I have the window.resize and window.moveto
> methods.
> Often (but not always) when I run the hta I have an "access denied" error
> on the line with
> window.resize.
> I tried self.moveto and self.resize and I had the same problem.
> It's something like the window is not yet available to receive commands.
> It happens when the hta is run from the desktop.
> I moved the commands after the assignment of the values to the array in
> order to let the
> hta be aware of being loaded, but it didn't work.
> Are there other methods to resize an hta window?
> Thank you.
>
> Giovanni
>
>
> ------------------------------------------
>
> <html>
> <head>
> <title>Equivalenze - Cenati Giovanni</title>
> <HTA:APPLICATION
> ID="objHTAEquivalenze"
> APPLICATIONNAME="Equivalenze"
> SCROLL="no"
> SINGLEINSTANCE="no"
>>
>
> <style>
>
> </style>
>
> <script language="vbscript">
> 'Equivalenze.hta
> 'Cenati Giovanni
> 'http://digilander.libero.it/Cenati
> Dim marca(10,10) ' variabile globale
> Sub Window_Onload
> marca(1,0)="kg - kilogrammi"
> marca(1,1)="hg - ettogrammi"
> marca(1,2)="dag - decagrammi"
> marca(1,3)="g - grammi"
> marca(1,4)="dg - decigrammi"
> marca(1,5)="cg - centigrammi"
> marca(1,6)="mg - milligrammi"
> marca(2,0)="kl - kilolitri"
> marca(2,1)="hl - ettolitri"
> marca(2,2)="dal - decalitri"
> marca(2,3)="l - litri"
> marca(2,4)="dl - decilitri"
> marca(2,5)="cl - centilitri"
> marca(2,6)="ml - millilitri"
> marca(3,0)="km - kilometri"
> marca(3,1)="hm - ettometri"
> marca(3,2)="dam - decametri"
> marca(3,3)="m - metri"
> marca(3,4)="dm - decimetri"
> marca(3,5)="cm - centimetri"
> marca(3,6)="mm - millimetri"
> marca(4,0)="km2 - kilometri quadrati"
> marca(4,1)="hm2 - ettometri quadrati"
> marca(4,2)="dam2 - decametri quadrati"
> marca(4,3)="m2 - metri quadrati"
> marca(4,4)="dm2 - decimetri quadrati"
> marca(4,5)="cm2 - centimetri quadrati"
> marca(4,6)="mm2 - millimetri quadrati"
> marca(5,0)="km3 - kilometri cubi"
> marca(5,1)="h3 - ettometri cubi"
> marca(5,2)="dam3 - decametri cubi"
> marca(5,3)="m3 - metri cubi"
> marca(5,4)="dm3 - decimetri cubi"
> marca(5,5)="cm3 - centimetri cubi"
> marca(5,6)="mm3 - millimetri cubi"
>
> window.ResizeTo 800,250
> window.MoveTo 50,50
> 'Carico il primo elenco di misure
> For i= 0 To 6
> Da1.options(i).text=marca(1, i)
> A1.options(i).text=marca(1, i)
> Next
> End Sub
>
> Sub Calcola
>
> 'Devo spostare la virgola di quante posizioni?
> Posizioni=A1.value - da1.value
> 'Se � una misura di metri quadri raddoppio le posizioni
> If Misure.value=4 Then posizioni=posizioni*2
> 'Se � una misura di metri cubi triplico le posizioni
> If Misure.value=5 Then posizioni=posizioni*3
> 'E calcolo il risultato
> 'MsgBox Da1.value & "..." & A1.value & " " & Posizioni
> On Error Resume Next 'Errore se valore � stringa vuota
> Risultato1.value= Valore1.value* 10^(posizioni)
> On Error Goto 0
>
> end Sub
>
> Sub Cancella 'Quando seleziono la casella col valore da modificare
> Risultato1.value=""
> End Sub
>
> Sub Aggiorna 'Quando cambia l'unit� di misura
> For i= 0 To 6
> Da1.options(i).text=marca(misure.value, i)
> A1.options(i).text=marca(misure.value, i)
> Next
> Calcola ' Perch� si pu� passare a metri quadrati o cubi.
> End Sub
> </script>
>
> </head>
> <body style="background-color: #ffcc99;">
> <h1>Equivalenze</h1>
> Misure di <select size="1" name="Misure" onchange="Aggiorna">
> <option value="1">g - grammi - Peso e massa</option>
> <option value="2">l - litri - capacit�</option>
> <option value="3">m - metri - lunghezza</option>
> <option value="4">m2 - metri quadrati - superficie</option>
> <option value="5">m3 - metri cubi - volume</option>
> </select>
> <p>
> <select size="1" name="Da1" onchange="Calcola">
> <option value="1">kg - kilogrammi</option>
> <option value="2">hg - ettogrammi</option>
> <option value="3">dag - decagrammi</option>
> <option value="4">g - grammi</option>
> <option value="5">dg - decigrammi</option>
> <option value="6">cg - centigrammi</option>
> <option value="7">mg - milligrammi</option>
> </select>
>
> &nbsp;<input name="Valore1" onfocus="Cancella" onblur="Calcola"> =&nbsp;
> <select size="1" name="A1" onchange="Calcola">
> <option value="1">kg - kilogrammi</option>
> <option value="2">hg - ettogrammi</option>
> <option value="3">dag - decagrammi</option>
> <option value="4">g - grammi</option>
> <option value="5">dg - decigrammi</option>
> <option value="6">cg - centigrammi</option>
> <option value="7">mg - milligrammi</option>
> </select>
>
> &nbsp;<input readonly="readonly" name="Risultato1"><br>
>
> <br>
>
> <br>
> Cenati Giovanni
> <br>
>
> </body>
> </html>

Why REsize. Why not just set the position and size before the window opens?

Example:
<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">
</SCRIPT>
<body>

</body>
</html>

-Paul Randall


From: Reventlov on
Il giorno Tue, 31 Aug 2010 10:59:42 -0500, "Paul Randall" <paulr901(a)cableone.net> ha
scritto:
>"Reventlov" <noone(a)no.void> wrote in message
>news:4c7d0df5.2369625(a)powernews.libero.it...
>> Hello,
>> I'm writing this hta to transform values between km, m, hm, etc (but also
>> litres, kg, square metres)
>>
>> In the window_onload sub I have the window.resize and window.moveto
>> methods.
>> Often (but not always) when I run the hta I have an "access denied" error
>> on the line with
>> window.resize.
>
>Why REsize. Why not just set the position and size before the window opens?
><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

I'm learning that the position of the script tag affects the behaviour of the application.
I thought I could only use the window_onload sub, but everything outside a sub or function
is automatically executed.
The ReSize before the HTA tag is working well. When the hta is run from the desktop I
don't get the Access Denied error.
Thank you.
Giovanni

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

"Reventlov" <noone(a)no.void> wrote in message
news:4c80b685.1741578(a)powernews.libero.it...
> Il giorno Tue, 31 Aug 2010 10:59:42 -0500, "Paul Randall"
> <paulr901(a)cableone.net> ha
> scritto:
>>"Reventlov" <noone(a)no.void> wrote in message
>>news:4c7d0df5.2369625(a)powernews.libero.it...
>>> Hello,
>>> I'm writing this hta to transform values between km, m, hm, etc (but
>>> also
>>> litres, kg, square metres)
>>>
>>> In the window_onload sub I have the window.resize and window.moveto
>>> methods.
>>> Often (but not always) when I run the hta I have an "access denied"
>>> error
>>> on the line with
>>> window.resize.
>>
>>Why REsize. Why not just set the position and size before the window
>>opens?
>><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
>
> I'm learning that the position of the script tag affects the behaviour of
> the application.
> I thought I could only use the window_onload sub, but everything outside a
> sub or function
> is automatically executed.
> The ReSize before the HTA tag is working well. When the hta is run from
> the desktop I
> don't get the Access Denied error.
> Thank you.
> Giovanni
>
> --
> Giovanni Cenati (Bergamo, Italy)
> Write to "Reventlov" at katamail com
> http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
> --

Does <html>, <head>, <title>, <vbscript>, <SCRIPT>,or <HTA:APPLICATION> come
from the internet?


From: Todd Vargo on
Kenneth A. Larsen wrote:
> "Reventlov" <noone(a)no.void> wrote in message
> news:4c80b685.1741578(a)powernews.libero.it...
>> Il giorno Tue, 31 Aug 2010 10:59:42 -0500, "Paul Randall"
>> <paulr901(a)cableone.net> ha
>> scritto:
>>>"Reventlov" <noone(a)no.void> wrote in message
>>>news:4c7d0df5.2369625(a)powernews.libero.it...
>>>> Hello,
>>>> I'm writing this hta to transform values between km, m, hm, etc (but
>>>> also
>>>> litres, kg, square metres)
>>>>
>>>> In the window_onload sub I have the window.resize and window.moveto
>>>> methods.
>>>> Often (but not always) when I run the hta I have an "access denied"
>>>> error
>>>> on the line with
>>>> window.resize.
>>>
>>>Why REsize. Why not just set the position and size before the window
>>>opens?
>>><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
>>
>> I'm learning that the position of the script tag affects the behaviour of
>> the application.
>> I thought I could only use the window_onload sub, but everything outside
>> a sub or function
>> is automatically executed.
>> The ReSize before the HTA tag is working well. When the hta is run from
>> the desktop I
>> don't get the Access Denied error.
>> Thank you.
>> Giovanni
>>
>> --
>> Giovanni Cenati (Bergamo, Italy)
>> Write to "Reventlov" at katamail com
>> http://digilander.libero.it/Cenati (Esempi e programmi in VbScript)
>> --
>
> Does <html>, <head>, <title>, <vbscript>, <SCRIPT>,or <HTA:APPLICATION>
> come from the internet?

http://lmgtfy.com/?q=What+is+HTML%3F

--
Todd Vargo

(Post questions to group only. Remove "z" to email personal messages)

From: Paul Randall on

"Reventlov" <noone(a)no.void> wrote in message
news:4c80b685.1741578(a)powernews.libero.it...
> Il giorno Tue, 31 Aug 2010 10:59:42 -0500, "Paul Randall"
> <paulr901(a)cableone.net> ha
> scritto:
>>"Reventlov" <noone(a)no.void> wrote in message
>>news:4c7d0df5.2369625(a)powernews.libero.it...
>>> Hello,
>>> I'm writing this hta to transform values between km, m, hm, etc (but
>>> also
>>> litres, kg, square metres)
>>>
>>> In the window_onload sub I have the window.resize and window.moveto
>>> methods.
>>> Often (but not always) when I run the hta I have an "access denied"
>>> error
>>> on the line with
>>> window.resize.
>>
>>Why REsize. Why not just set the position and size before the window
>>opens?
>><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
>
> I'm learning that the position of the script tag affects the behaviour of
> the application.
> I thought I could only use the window_onload sub, but everything outside a
> sub or function
> is automatically executed.
> The ReSize before the HTA tag is working well. When the hta is run from
> the desktop I
> don't get the Access Denied error.

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