Search code examples
windowsinternet-explorer-11hta

HTA, how to programmatically resize all elements in window while placing it on desktop where needed


I have read this highly useful post which unfortunately did not resolve my question: How may I use code in the HTA to scale down (shrink) the entire contents of the window, text and boxes both, in an HTA file? I'm using IE11 (or, it uses me), and I need to Ctrl-Scroll to downsize the window content every time I open it.

Now, I added meta http-equiv="x-ua-compatible" content="ie=edge" as suggested in comments, but now that breaks the placement of the file at position 1920,0 . Is there a solution which will allow resizing AND allow me to place the window where I need it?

<html><title>A Form </title> 
<meta http-equiv="x-ua-compatible" content="ie=edge" />.
<body style="filter:progid:DXImageTransform.Microsoft.Gradient(endColorstr='#C0CFE2', startColorstr='#365ebf', gradientType='0');"> 
<head>

<script language="JavaScript">window.resizeTo(320,1080);</script> 
<style type="text/css"> 
body { 
 transform: scale(0.9);
 height: 90%; 
 background-color: #EFEFDC; 
 font-family: Arial Narrow; 
 font-size: 12px; 
 color: #343421; 
 margin: 2px;  
filter: none !important; 
} 

b { 
 font-size: 16px; 
 padding: 1en; 
} 

</style>

<SCRIPT Language="VBScript">
    Sub Window_Onload
        window.moveTo 1920, 0
    End Sub
</SCRIPT>

Solution

  • I reread your question and your comments and I think I understand your requirements better. To programmatically increase the zoom level of all your controls use something similar to:

    <script>
    document.body.style.zoom = "200%"
    </script>
    

    Feel free to add this code anywhere, I tried it at the end of the script body and it worked for me:

    <html>
    <head>
    <title>A Form</title>
    <meta http-equiv="x-ua-compatible" content="IE=edge" />
    <style>
    html {
        height: 100%;
    }
    body {
        -ms-zoom: 0.50;
        background-image: linear-gradient(135deg, #C0CFE2, #365ebf);
    }
    </style>
    </head>
    
    <body>
    
    What is your name?<p>
    
    <input id="name" value="Luke"></input><p>
    
    <input type="button" value="CLICK ME" onclick="alert('Obi-Wan says: Use the Force, ' + document.getElementById('name').value + '.')"><p>
    
    </body>
    <script>
      window.moveTo(100, 300);
      window.resizeTo(500, 300);
    </script>
    
    <script>
    document.body.style.zoom = "200%"
    </script>
    
    </html>
    

    enter image description here