1

I have a Python script which I would like to run from a HTA. However, I was not able to get this to work. Here is my HTA code:

<!DOCTYPE html>

<head>
    <HTA:APLICATION>
    <title>Python Test</title>
</head>

<body>
    <script language =python src = "t.pys"></script>
    <form><button onclick = "d1()">c</button></form>
</body>    
</html>

And here is my Python code:

def d1():
    alert("A")

When I try to run it and press the button, I get this error message:

the value of the property d1 is null or undefined

I'm using Active Python 3.6, I already pip-installed PyWin32 and registered Python with C:\Python36\Lib\site-packages\win32comext\axscript\client\pyscript.py. I also tried with regular Python 3.6 doing the same process with no success.

Also, I tried changing the language =python with language = "python" and language = "Python", and using a .py file, but I got the same result.

I was able to run a simple "Hello World" by running CScript.exe script.pys. The Python script I want to run would be really hard to translate into JScript, as it uses functions not present in this language. Any help would be greatly appreciated.

Ben Usman
  • 7,969
  • 6
  • 46
  • 66
  • Have you seen https://stackoverflow.com/a/7644962/18771 (especially the comment under the answer)? – Tomalak Jun 20 '18 at 17:30

0 Answers0