Reputation: 405
Can i get the current window position in HTA (HTML Application)? which is similar with Me.Top
and Me.Left
in VB6, but i want it get the pixels number.!?
Upvotes: 1
Views: 1077
Reputation: 473
Here's a cool way to do it. It's sorta animated
VBScript
Add this to global variables
Dim IntervalMovingWindow
then add this OnLoad routine
Sub Window_OnLoad
moveTo screen.availWidth/2-200 , screen.availHeight/2-100
IntervalMovingWindow= Setinterval ("MoveTheWindow",100)
End Sub
Then Add this Routine for moving windows (animated style)
Sub MoveTheWindow
Dim X,Y
X=top.screenleft
Y=top.screentop
If X<=60 Then
X=0
End If
If Y<=60 Then
Y=0
End If
If X<>0 Then
moveBy -20,0
End If
If Y<>0 Then
moveBy 0,-20
End If
If X=0 And Y=0 Then
moveto 0,0
clearInterval IntervalMovingWindow
End If
End Sub
This may not work if you have an excessively large border. in that case you may need to change -20
in the moveBy
to a larger negative number like -30
and the If {X or Y}=60
into a larger positive number like If {X or Y}=80
NOTE don't include the Braces '{}' they just mean that i am talking about both X and the Y conditionals.
Upvotes: 1
Reputation: 23406
With JS you can get the position of the topmost window with top.screenLeft
and top.screenTop
.
Upvotes: 2