0
我是VBScripting的新手,但已經能夠使用VBScript創建一些.wsf文件,這對我幫助很大。在.hta文件中使用VBScript
我已決定採取這一步,使他們更多地使用HTML應用程序交互。我在這方面做了很多工作,看起來我不能在.hta文件中使用WScript,但是我看不到一個乾淨而簡單的方法來實現它。我非常感謝一些建議或最佳實踐的想法,以幫助我擺脫困境。
不管怎樣,代碼是這樣的,希望是非常自我解釋:
set fs = WScript.CreateObject("Scripting.FileSystemObject")
set oShell = CreateObject("Wscript.Shell")
set objShell = CreateObject("Shell.Application")
currDir = oShell.currentDirectory
CreateFolder(C:\TEMP1234")
Function CreateFolder(foldr)
dim create
if(fs.FolderExists(foldr)) then
Msgbox "Folder already exists: "+foldr
else
fs.CreateFolder(foldr)
end if
End Function
</script>
<body>
<p>Please make selection</p>
<input type="checkbox" name="Selection" value="1.">Option 1<br>
<input type="checkbox" name="Selection" value="2.">Option 2<br>
<input id=runbutton class="button" type="button" value="OK" name="ok_button" onClick"getSelection">
<input id=runbutton class="button" type="button" value="Cancel" name="cancel_button" onClick="CancelScript>
</body>
<script language="VBScript">
Sub getSelection
if Selection(0).Checked then
option1
end if
if Selection(1).Checked then
option2
end if
if radioChoice="" then
exit sub
end if
end sub
Sub CancelScript
Self.Close()
end sub
sub option1
Msgbox "Option 1 Selected"
end sub
sub option2
Msgbox "Option 2 selected"
end sub
</script>
在此先感謝!