HTA+Batch hybrid; sheet.cssRules.length fails when file is too large

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Lowsun
Posts: 29
Joined: 14 Apr 2019 17:22

HTA+Batch hybrid; sheet.cssRules.length fails when file is too large

#1 Post by Lowsun » 14 Apr 2019 17:37

After reading about HTA input forms on viewtopic.php?t=6581, I immediately tried to work it into a script I was creating. However, after the script grew larger and larger, it suddenly started failing. In one part of the Javascript in the HTML section, I have this function:

Code: Select all

function insertRule(rule){
  sheet.insertRule(rule, sheet.cssRules.length);
 }
To insert CSS rules. However at some point, it kept displaying:

Code: Select all

"Unable to get propery .length of undefined or null reference"
After some experimentation, I discovered that it was because of the file size. For example:

Code: Select all

<!-- :: Batch section
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
MSHTA.exe "%~F0"
PAUSE
EXIT /B

::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFF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FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

HTML -->
<HTML>

  <HEAD>
    <HTA:APPLICATION SCROLL="no" BORDER="none" CAPTION="no" SHOWINTASKBAR="no" SYSMENU="no" ID="Card">
    <META HTTP-EQUIV="x-ua-compatible" CONTENT="IE=9"/>
    <STYLE TYPE="TEXT/CSS">
      body {
        background: #ffffff
      }
      button {
        position:absolute;
        left:10px;
        color:#ffffff;
        font-family: Arial, Sans Serif;
        border:1px solid #ffffff;
        border-radius:3px;
        letter-spacing:0.3px;
        font-size:20px;
        padding:10px
      }
    </STYLE>
  </HEAD>

  <BODY>
    <BUTTON>Hello</BUTTON>
    <SCRIPT LANGUAGE="JavaScript">
      sheet = window.document.styleSheets[0];
      insertRule("button { background: #35507a; }")
      function insertRule(rule){
        sheet.insertRule(rule, sheet.cssRules.length);
      }
    </SCRIPT>
  </BODY>

<HTML>
Works fine. However, add a couple more lines:

Code: Select all

<!-- :: Batch section
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
MSHTA.exe "%~F0"
PAUSE
EXIT /B

::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFF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FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

HTML -->
<HTML>

  <HEAD>
    <HTA:APPLICATION SCROLL="no" BORDER="none" CAPTION="no" SHOWINTASKBAR="no" SYSMENU="no" ID="Card">
    <META HTTP-EQUIV="x-ua-compatible" CONTENT="IE=9"/>
    <STYLE TYPE="TEXT/CSS">
      body {
        background: #ffffff
      }
      button {
        position:absolute;
        left:10px;
        color:#ffffff;
        font-family: Arial, Sans Serif;
        border:1px solid #ffffff;
        border-radius:3px;
        letter-spacing:0.3px;
        font-size:20px;
        padding:10px
      }
    </STYLE>
  </HEAD>

  <BODY>
    <BUTTON>Hello</BUTTON>
    <SCRIPT LANGUAGE="JavaScript">
      sheet = window.document.styleSheets[0];
      insertRule("button { background: #35507a; }")
      function insertRule(rule){
        sheet.insertRule(rule, sheet.cssRules.length);
      }
    </SCRIPT>
  </BODY>

<HTML>
And suddenly, it doesn't work. Are there any ways to fix this and overcome this problem?

penpen
Expert
Posts: 2009
Joined: 23 Jun 2013 06:15
Location: Germany

Re: HTA+Batch hybrid; sheet.cssRules.length fails when file is too large

#2 Post by penpen » 16 Apr 2019 06:04

I suspect that either the html comment has a maximum length, or the "<hta:...>" element must be within a given offset of the file, else some weird bug triggers... . I suggest to use a comment as short as possible and put the batch portion into a script tag.

So hopefully the folllowing works (without triggering bugs):

Code: Select all

<!-- :: Batch section
goto :main
-->
<HTML>
  <HEAD>
    <HTA:APPLICATION SCROLL="no" BORDER="none" CAPTION="no" SHOWINTASKBAR="no" SYSMENU="no" ID="Card">
<script language="text/batch">
:main
@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION
MSHTA.exe "%~F0"
PAUSE
EXIT /B


::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFF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FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
::STUFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF

</script>
    <META HTTP-EQUIV="x-ua-compatible" CONTENT="IE=9"/>
    <STYLE TYPE="TEXT/CSS">
      body {
        background: #ffffff
      }
      button {
        position:absolute;
        left:10px;
        color:#ffffff;
        font-family: Arial, Sans Serif;
        border:1px solid #ffffff;
        border-radius:3px;
        letter-spacing:0.3px;
        font-size:20px;
        padding:10px
      }
    </STYLE>
  </HEAD>
  <BODY>
    <BUTTON>Hello</BUTTON>
    <SCRIPT LANGUAGE="JavaScript">
      sheet = window.document.styleSheets[0];
      insertRule("button { background: #35507a; }")
      function insertRule(rule){
        sheet.insertRule(rule, sheet.cssRules.length);
      }
    </SCRIPT>
  </BODY>

<HTML>
Sidenote: In addition it is recommended to define functions, before using them - although it seems to work here (and also isn't the cause of the above bug).


penpen

Edit: Added the ":main" label... .

Lowsun
Posts: 29
Joined: 14 Apr 2019 17:22

Re: HTA+Batch hybrid; sheet.cssRules.length fails when file is too large

#3 Post by Lowsun » 16 Apr 2019 17:20

Put it in it's own <SCRIPT> tag and it works. Thanks!

Post Reply