简体   繁体   中英

HTA application: Place window at the bottom-right of the screen

I'm trying to move my hta application window to the bottom-right of my desktop (screen). If I put static values, then It works but I want to place the window at the bottom-right for every screen resolution. I don't know how to say to the .hta "place the window 50% from the top border and 5% from the right border". Here's my little script:

<script language="VBScript">
   'On Error Resume Next
   window.resizeTo 450, 400
   var monitorHeight = screen.Height;
   var monitorWidth = screen.Width; 

    window.moveTo monitorWidth-450, monitorHeight-400



    window.moveTo WindowLeft,WindowTop 

</script>

I can center the window:

<script language="VBScript">
  'On Error Resume Next   
  window.resizeTo 450, 400
window.moveTo (screen.width -450) / 2, (screen.height-400) / 2
</script>

But can't put the window at the bottom-right.

You can try something like that :

<script language="VBScript">
    window.resizeTo 450,400
    WindowLeft = (window.screen.availWidth - 450)  
    WindowTop  = (window.screen.availHeight - 400)
    window.moveTo WindowLeft, WindowTop
</script>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM