China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-03 17:13
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] How to generate a checkbox on a web page and return it to the CMD according to the user's selection View 2,254 Replies 27
Original Poster Posted 2007-02-19 23:06 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
First of all, I wish everyone a happy new year, good health, peace and happiness every day.

Today I'm bored with nothing to do, so I come online and want to ask a question: batch installation of green software.

I used FOR /F "DELIMS=" %%I IN ('DIR /S/B *G.EXE') DO ECHO %%I to obtain the paths of all green software that need to be installed (the EXE files whose last character is G at the end). Although I obtained the green software, I want users to select and install according to this list. How to achieve it? Pure DOS seems not possible. I want to generate an HTML file through CMD because checkboxes can be used in HTML files, and users can select which software to install according to these checkboxes. But how to achieve it? I know nothing about HTML programming. So I can only ask you brothers to give more opinions. (I saw before "Who said that the batch processing interface is not beautiful, and I want such an effect.")

My batch processing content is as follows (note that IPATH is the decompression path used in the RAR compression in advance, and can be set in the batch processing to make RAR recognizable):

@echo off
SET PATH=%CD%;%CD%\TOOLS\;%PATH%
SET /P IPATH=Please enter the installation path (such as D:;e:\greensoft, omit the last \ when entering):
CLS
FOR /F "DELIMS=" %%I IN ('DIR /S/B *G.exe') DO (
IF NOT EXIST "%IPATH%\%%~nI" (
SET IPATH=%IPATH%\%%~nI
ECHO Is installing %%~nI to %IPATH% below, please wait......
START /B/WAIT/MIN "" %%I)
)

PAUSE


[ Last edited by HUNRYBECKY on 2007-2-28 at 05:02 AM ]
Floor 2 Posted 2007-02-19 23:25 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
It seems there are very few people today, so I'll bump it myself.
Floor 3 Posted 2007-02-20 00:07 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Under the top, the previous post about the beautiful IE interface seems to have been deleted. It's not possible to download it for learning.
Floor 4 Posted 2007-02-20 02:54 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Well, still waiting. It seems there are more people asking questions today. The experts have all gone home for the New Year :-)
Floor 5 Posted 2007-02-27 23:36 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Maybe I didn't express it very clearly, let me explain.
I used the FOR command to obtain the list of portable software to be installed into a text file OK.TXT

PowerwordG.exe
winrarG.exe
QQG.exe


I want to let the user choose which portable software to install according to the content of OK.TXT, but it's cumbersome and not very beautiful directly in CMD, so I want to use a web form like "Who said batch processing interface is not beautiful" to generate a series of checkboxes according to the items in OK.TXT, then the user can choose freely, and then return the user's choice to CMD.
I don't know if I have made it clear like this.
Here is an effective example: http://www.blabla.cn/html_examples/056_form_input_check_checked.html

[ Last edited by HUNRYBECKY on 2007-2-28 at 04:51 AM ]
Floor 6 Posted 2007-02-27 23:53 ·  中国 甘肃 兰州 电信
金牌会员
★★★★
Credits 4,103
Posts 1,744
Joined 2006-01-20 13:00
20-year member
UID 49241
Gender Male
From 甘肃.临泽
Status Offline
If it's about HTML, then I don't know.
Floor 7 Posted 2007-02-28 00:39 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Well, Brother ZH159 said that someone said batch processing is not beautiful. It is implemented using BAT + VBS + HTML, and the effect is quite good. But I don't know the HTML syntax, so it's more troublesome. I hope experts who know HTML can answer.
Floor 8 Posted 2007-02-28 05:03 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
There has been no one to answer. Is it a bit difficult, or for other reasons? Those who pass by, give some opinions.
Floor 9 Posted 2007-02-28 11:43 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
I'm busy now. I'll write a paragraph when I have free time a few days later.
Floor 10 Posted 2007-03-01 00:41 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Thanks. Understand. But which program of yours am I researching now
Floor 11 Posted 2007-03-01 01:35 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
Originally posted by HUNRYBECKY at 2007-2-27 11:39:
Well, someone from Brother ZH159 said that batch processing is not beautiful. It is implemented using BAT + VBS + HTML, and the effect is quite good. However, I don't know the HTML syntax, so it's more troublesome. I hope experts who know HTML can answer.


Strictly speaking, is that batch processing? It calls...

That's just an IE interface... that's all. Can a single batch be used?

Batch can run exe. I don't know if it can be said that batch processing can be used for battle, video... and so on when running a cs, qq, war3.
Floor 12 Posted 2007-03-01 02:23 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
Batch processing is originally a collection of commands (internal commands, external commands), and various commands are called to complete the intended tasks.
Floor 13 Posted 2007-03-04 00:31 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Ask if it is possible to use FRAME to divide a web page into three parts. The first part is the page header, with a specified size and showing important information. The second part is the content, which displays a scrollbar according to the amount of content. The third part is the page footer, displaying other information. How to implement this in VBS?

For the code below, why does writing text directly in the LEFT of FRAME have no effect:


<html>
<head>
<frameset cols="50%,50%">
<frame name="left" src="">
<frame name="right" src="">
</frameset>
<script language="javascript">
function window.onload()
{
document.frames.item("left").document.write("11111");
document.frames.item("left").document.close();
}
</script>
</head>
</html>


[ Last edited by HUNRYBECKY on 2007-3-4 at 03:41 AM ]
Floor 14 Posted 2007-03-04 06:14 ·  中国 广西 玉林 博白县 电信
金牌会员
★★★★
Credits 3,687
Posts 1,467
Joined 2005-08-08 12:00
20-year member
UID 44210
Status Offline
This still needs to be connected to two HTML files in
<frame name="left" src="HTML file 1">
<frame name="right" src="HTML file 2">
to be effective

Write something simpler (delete two lines "goto min" by yourself, and change the following call echo start /w "%%%%i%%" to call start /w "%%%%i%%")

@echo off
goto min
mode con cols=25 lines=5
%1 %2
start /min /i "" "%~nx0" goto min&&exit

:min
if exist *.exe (
for /f "delims=" %%i in ('dir /on/a-d/b *.exe') do (
set /a Num+=1
call set "file%%Num%%=%%i"
))

>List.vbs echo set WshShell = Wscript.CreateObject("Wscript.Shell")
>>List.vbs echo set ie=wscript.createobject("internetexplorer.application","event_")
>>List.vbs echo ie.menubar=0
>>List.vbs echo ie.addressbar=0
>>List.vbs echo ie.toolbar=0
>>List.vbs echo ie.statusbar=0
>>List.vbs echo ie.resizable=0
>>List.vbs echo ie.width=600
>>List.vbs echo ie.height=600
>>List.vbs echo ie.navigate "about:blank"
>>List.vbs echo ie.left=fix((ie.document.parentwindow.screen.availwidth-ie.width)/2)
>>List.vbs echo ie.top=fix((ie.document.parentwindow.screen.availheight-ie.height)/2)
>>List.vbs echo ie.visible=1
>>List.vbs echo with ie.document
>>List.vbs echo .write "<html><title>Installation List</title><body background='bg.gif' bgcolor=#e3e5da style='font-family:SimSun-GB2312;font-size:24px;' scroll=yes><p align=center>Software List"
>>List.vbs echo .write "<table width=500 align=center border=1 cellSpacing=2 cellpadding=4 borderColor=#698cc2 style='font-family:SimSun;font-size:15px;border:#698cc2 2px solid;'>"
>>List.vbs echo .write "<tr align=center><td width=45><b>Serial Number</b></td><td><b>Software Name</b></td></tr>"

if exist *.exe (
for /l %%n in (1,1,%Num%) do >>List.vbs call echo .write "<tr><td align=center><b>%%n</b></td><td><input id=file%%n type=checkbox style=cursor:hand><label for=file%%n style=cursor:hand><b>Install “%%file%%n%%”</b></label></td></tr>"
) else (
>>List.vbs echo .write "<tr align=center><td width=45><b>None</b></td><td colspan=2><b>No EXE installation program in this directory</b></label></td></tr>"
)

>>List.vbs echo .write "</table><p align=center><input id=confirm type=submit value='Start Installation'></td></table></body></html>"
>>List.vbs echo end with
>>List.vbs echo dim wmi
>>List.vbs echo set wnd=ie.document.parentwindow
>>List.vbs echo set id=ie.document.all
>>List.vbs echo id.confirm.onclick=getref("confirm")
>>List.vbs echo do while true
>>List.vbs echo wscript.sleep 500
>>List.vbs echo WshShell.AppActivate ("Installation List - Microsoft Internet Explorer")
>>List.vbs echo loop
>>List.vbs echo sub event_onquit
>>List.vbs echo ie.visible=0
>>List.vbs echo wscript.quit
>>List.vbs echo end sub
>>List.vbs echo sub confirm
>>List.vbs echo ie.visible=0
>>List.vbs echo ie.quit
>>List.vbs echo with id

if exist *.exe for /l %%n in (1,1,%Num%) do >>List.vbs echo if .file%%n.checked then Wscript.Echo "file%%n"

>>List.vbs echo wscript.quit
>>List.vbs echo exit sub
>>List.vbs echo end with
>>List.vbs echo end sub

for /f "delims=" %%i in ('"cscript //nologo List.vbs"') do call echo start /w "%%%%i%%"
del List.vbs
exit


[ Last edited by zh159 on 2007-3-3 at 09:24 PM ]
Floor 15 Posted 2007-03-07 00:09 ·  中国 广东 东莞 电信
银牌会员
★★★
Credits 1,179
Posts 442
Joined 2006-09-09 22:47
19-year member
UID 62249
Status Offline
Originally posted by zh159 at 2007-3-4 06:14:
This still needs to be connected to two HTML files into
<frame name="left" src="html file 1">
<frame name="right" src="html file 2">
to be effective...


Thank you, Brother ZH for the answer. Currently, I am learning HTML programming. I have basically got the program done, but there is still a problem. The above-mentioned how to fix the header and footer on the same page. Using the FRAME method requires another two pages, which is very troublesome. So is there any other way to solve it? Does the FRAME really not solve it? Can it be realized by directly referencing the child FRAME in the parent FRAME for programming? If it is not solved, it is really ugly. The following is the VBS code, save it as VBS and everyone can test it.

'Reference the internetexplorer.application object of shdocvw.dll. If fullscreen=1, there is no title bar
set WshShell = Wscript.CreateObject("Wscript.Shell")
set ie=wscript.createobject("internetexplorer.application","event_")
ie.fullscreen=1
ie.menubar=0
ie.addressbar=0
ie.toolbar=0
ie.statusbar=0
ie.resizable=0
ie.width=600
ie.height=400
ie.navigate "about:blank"
ie.left=fix((ie.document.parentwindow.screen.availwidth-ie.width)/2)
ie.top=fix((ie.document.parentwindow.screen.availheight-ie.height)/2)
ie.visible=1
with ie.document
.write "<html><title>One-click Installation Manager</title><meta http-equiv='Content-Type' content='text/html; charset=gbk'>"
.write "<style type='text/css' id='css'>.button {font: 15px 宋体, Verdana;height:32px;width:100px;}</style>"
.write "<body onload=sf() background='D:\OK\sys\FAX\bg.gif' bgcolor=#e3e5da oncontextmenu='return false' scroll=yes style='font-family:宋体;font-size:15px;'>"
.write "<table align=center style='font-family:楷体_gb2312;font-size:24px;'><td><b>One-click Installation Manager V1.0</b></td></table>"
.write "<table width=550 align=center style='FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#9ab8f6,endColorStr=#5a7dde)'><td align=left style='font-size:1px;'> </td></table>"
.write "<table width=550 align=center borderColor=#698cc2 border=1 cellSpacing=0 cellpadding=5 style='font-size:15px;border:#5a7dde 3px solid;'>"
.write "<tr><td align=center bgcolor=#698cc2 style='FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#9ab8f6,endColorStr=#5a7dde)' colspan=4><b><font style=font-size:18px;color:#ffffff;> Welcome to use One-click Installation Manager </font><br><font style=color:#d0d0d0;><a title='China DOS Union Forum'>QQ:9399100</a>  <a title='Refer to Brother zh159's IE batch processing interface writing'>EMAIL:xiaobudian528@yahoo.com.cn</a></font></b></td></tr>"
.write "<tr><td align=left colspan=4><b>Select the following software to install, then click Install to proceed</td><tr>"
.write "<tr align=center><td colspan=1><b>Software Name</b></td><td colspan=3><b>Software Description</b></td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='32bit Fax x9.43.01 汉化版.exe'><b>32bit Fax x9.43.01 Chinese Version</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='FaxMail Network 94301.exe'><b>FaxMail Network 94301</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='HB-RelayFax504pro.rar'><b>HB-RelayFax504pro</b></td>"
.write "<td align=left colspan=3> ;The following comments contain self-extracting script commands</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='mf32_9X(mightyfax3.08).rar'><b>mf32_9X(mightyfax3.08)</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='mf32_NT(MightyFAX3.08).rar'><b>mf32_NT(MightyFAX3.08)</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='MightyFAX 3.08_9X_HYQ9.rar'><b>MightyFAX 3.08_9X_HYQ9</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='MightyFAX 3.08_NT_HYQ9.rar'><b>MightyFAX 3.08_NT_HYQ9</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='PC-Telephone V5.9(支持网络电话传真).exe'><b>PC-Telephone V5.9(Supports Network Telephone Fax)</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='test.rar'><b>test</b></td>"
.write "<td align=left colspan=3> width and height attributes respectively specify a fixed width and length of the table, n1 and n2 can be expressed in pixels or as a percentage (compared with the size of the entire screen...rowsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='VentaFax 5.7.26.exe'><b>VentaFax 5.7.26</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=1><INPUT type='checkbox' CHECKED name='InStallList' value='WINFAXminiview.exe'><b>WINFAXminiview</b></td>"
.write "<td align=left colspan=3>&nbsp</td><tr>"
.write "<tr><td align=left colspan=4 bgcolor=#698cc2 style='FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#9ab8f6,endColorStr=#5a7dde);'><font style=font-size:15px;color:#ffffff;><b>Installation Mode:</b><input type='radio' CHECKED name='INSTALLMODLE' value='M1' title='The default is to install in the conventional way, which can not only install green software, but also install ordinary software. When installing green software, it can also be installed without pre-compression'>One-click Conventional Installation<input type='radio' name='INSTALLMODLE' value='M2' title='Can only install pre-compressed green software, non-green software will be ignored'>One-click Green Installation<input type='radio' name='INSTALLMODLE' value='M3' title='Repair the installed green software, requiring that there is GSETUP.bat in the green software directory'>One-click Green Repair<input type='radio' name='INSTALLMODLE' value='M4' title='Uninstall the installed green software, requiring that there is install.bat in the green software directory'>One-click Green Uninstall<br><B>Installation Path:</B><input type='text' ID='IPATH' name='IPATH' SIZE='70'value='D:\GREEN' title='When setting, pay attention not to enter the last \ of the path, for example, C: should not be set to C:\, for example, C:\MYSOFT should not be set to C:\MYSOFT\, in addition, if not set, the default installation path is D:\GREEN'></font></td></tr>"
.write "<tr><td align=center width=25% style='font-size:0px;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#9ab8f6,endColorStr=#5a7dde);'> </td><td align=center width=25% style='font-size:0px;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#9ab8f6,endColorStr=#5a7dde);'></td>"
.write "<td align=center width=25% style='font-size:0px;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#9ab8f6,endColorStr=#5a7dde);'> </td><td align=center width=25% style='font-size:0px;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#9ab8f6,endColorStr=#5a7dde);'> </td><tr></table>"
.write "<table width=550 align=center border=0 cellSpacing=0 cellpadding=5 ><tr align=center><td align=center width=25%><input id=btALL type=submit class=button value='Select All' title='Select All or Cancel All to facilitate software installation' style='font-family:楷体_gb2312;font-size:21px;width=100;border: 1 solid #9ab8f6;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#10bfff,endColorStr=#007db2);cursor:hand;color:#ffffff;'></td><td align=center width=25%><input id=btInstall type=button class=button value='Install Now' title='Install the selected software now' style='font-family:楷体_gb2312;font-size:21px;width=100;border: 1 solid #9ab8f6;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#10bfff,endColorStr=#007db2);cursor:hand;color:#ffffff;'></td>"
.write "<td align=center width=25%><input id=btGInStallList type=button class=button value='Make Installation Script' title='Generate InStallList.TXT file in the current directory to facilitate installation according to this file, so that software comments can be set arbitrarily and installation speed can be improved.' style='font-family:楷体_gb2312;font-size:21px;width=140;border: 1 solid #9ab8f6;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#10bfff,endColorStr=#007db2);cursor:hand;color:#ffffff;'></td><td align=center width=25%><input type=button class=button onClick='opener=null;window.close()' value='Exit Program' title='Exit Installation Program' style='font-family:楷体_gb2312;font-size:21px;width=100;border: 1 solid #9ab8f6;FILTER: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#10bfff,endColorStr=#007db2);cursor:hand;color:#ffffff;'></td></tr></td></table>"
.write "</body></html>"
end with
dim wmi
set wnd=ie.document.parentwindow
set id=ie.document.all
id.btAll.onclick=getref("btALL")
id.btInstall.onclick=getref("btInstall")
id.btGInStallList.onclick=getref("btGInStallList")
do while true
wscript.sleep 500
WshShell.AppActivate ("One-click Installation Manager - Microsoft Internet Explorer")
loop
sub event_onquit
Wscript.Echo "exit"
wscript.quit
end sub
sub btALL
with id
if .btALL.value="Select All" then
for sx=0 to .InStallList.length-1
.InStallList(sx).checked=-1
next
.btALL.value="Cancel All"
elseif .btALL.value="Cancel All" then
for sx=0 to .InStallList.length-1
.InStallList(sx).checked=0
next
.btALL.value="Select All"
end if
end with
end sub
sub btGInStallList
msg="Making the installation script will exit and restart this program, are you sure?"
ie.visible=0
IF MsgBox(msg,vbQuestion+vbYesNo,"Xiao Budian Reminds You")=vbNo then
ie.visible=1
exit sub
END IF
Wscript.Echo "btGInStallList"
ie.quit
end sub
sub btInstall
ie.visible=0
with id
if .IPATH.value="" then
msgbox "Installation path cannot be empty, please re-enter!"
ie.visible=1
exit sub
elseif right(.IPATH.value,1)="\" then
msgbox "The last character of the installation path cannot be \, please re-enter!"
ie.visible=1
exit sub
end if
Wscript.Echo .IPATH.value
dim mx
for mx=0 to 3
if .INSTALLMODLE(mx).checked=-1 then Wscript.Echo .INSTALLMODLE(mx).value
next
dim sx,nx
if isobject(InStallList)=fale then exit sub
nx=0
for sx=0 to .InStallList.length-1
if .InStallList(sx).checked=-1 then
nx=nx+1
Wscript.Echo .InStallList(sx).value
end if
next
ie.quit
end with
end sub



[ Last edited by HUNRYBECKY on 2007-3-7 at 01:08 AM ]
Forum Jump: