Mypc in HTA

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
einstein1969
Expert
Posts: 976
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Mypc in HTA

#1 Post by einstein1969 » 17 Jun 2014 13:36

Sharing this even is not useful

myPC.hta

Code: Select all

<object classid="clsid:8856F961-340A-11D0-A96B-00C04FD705A2" width="100%" height="100%">
<param name="location" value="shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}">
</ Object>


einstein1969

Squashman
Expert
Posts: 4488
Joined: 23 Dec 2011 13:59

Re: Mypc in HTA

#2 Post by Squashman » 17 Jun 2014 13:39

Isn't there a hybrid way to run HTA from batch?
Maybe you should include that with your examples as well.

einstein1969
Expert
Posts: 976
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Mypc in HTA

#3 Post by einstein1969 » 17 Jun 2014 14:40

Like this?

MyPc_hta.cmd

Code: Select all

<!-- :: cmd part
@echo off
start "" mshta.exe "%~f0"
exit /b & rem -->

<html>
<head><title>HTA window</title></head>
<body><h1>Hello, world!</h1>
<object classid="clsid:8856F961-340A-11D0-A96B-00C04FD705A2" width="100%" height="100%"><param name="location" value="shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}"></Object>

</body>
</html>


this is a folder in a hta windows, passed with parameter

folder_hta.cmd

Code: Select all

<!-- :: cmd part
@echo off
start "" mshta.exe "%~f0" %*
exit /b & rem -->

<html>
<head>
<hta:application id=hta> </hta: application>
<script language=vbscript>
Option Explicit
Sub window_onload
Dim fQuoting
Dim k
fQuoting = False
For k = 1 To Len (hta.commandLine)
Select Case Mid (hta.commandLine, k, 1)
Case Chr (34) fQuoting = Not fQuoting
Case Chr (32) If Not fQuoting Then Exit For
End Select
Next
document.all.f1.src=Replace(Mid(hta.commandLine,k+1),"""","")
document.title = document.all.f1.src
End Sub
</Script>
</Head>
<frameset>
<frame id=f1 src="about:blank">
</Frameset>
</Html>

usage:

Code: Select all

folder_hta.cmd c:\windows



einstein1969

einstein1969
Expert
Posts: 976
Joined: 15 Jun 2012 13:16
Location: Italy, Rome

Re: Mypc in HTA

#4 Post by einstein1969 » 17 Jun 2014 14:46

this is nice:

Code: Select all

<!-- :: cmd part
@echo off
start "" mshta.exe "%~f0"
exit /b & rem -->

<html>
<frameset>
<frame src=".">
</Frameset>
</Html>

Post Reply