I successfully create a simple web-based chat app by simply following this tutorial
The only difference is I did not include the login thing. It only keeps making post messages in log.html.
Now I'm trying to do this in HTA. And it is my first time to use it. I'm still learning, and currently to this :
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=9" />
<meta charset="utf-8" />
<title>Chat-App</title>
<meta name="description" content="Chat-App" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<link rel="stylesheet" type="text/css" href="font-awesome-animation.min.css"/>
<link rel="stylesheet" href="styles.css" />
<HTA:APPLICATION
SCROLL="auto"
SINGLEINSTANCE="yes"
WINDOWSTATE="normal"/>
<script language="VBScript">
Sub window_OnLoad
Window.ResizeTo 680,723
iTimerID = window.setInterval("Display", 1000)
End Sub
strPath = "C:\Users\username\Desktop\Chat App\"
Set wshShell = CreateObject( "WScript.Shell" )
'strSender = wshShell.ExpandEnvironmentStrings( "%USERNAME%" )
Sub Display
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(StrPath & "log.html", 1)
strCharacters = objFile.ReadAll
objFile.Close
chatbox.innerHTML = strCharacters
chatbox.ScrollTop = chatbox.ScrollHeight
End Sub
</script>
</head>
<body style="background-color:grey;">
<div id="wrapper">
<h1 style="margin-top: 5px;margin-left:20px;color:orange;">Chat-App</h1>
<div id="chatbox" name="chatbox" class="textbox">
</div>
<form name="message" action="">
<textarea rows="10" cols="30" name="usermsg" type="text" id="usermsg" style="height:200px;" placeholder="Type your message here..."></textarea>
<input name="submitmsg" type="submit" id="submitmsg" value="Send" />
</form>
</div>
</body>
</html>
this is the output ..ChatApp
This only get the content of log.html then display in chatbox div. But it has an error saying 'Display' is not defined. And textarea doesn't even look like a textarea.
Other than that I don't know how to achieve the posting messages in log.html and refresh it every set seconds like in the tutorial. I tried pasting the javascript that works in web based but it doesn't work when I convert it to hta. Can someone help me to do it in HTA ?