复制代码 代码如下:
<html>
<head>
<title>Tweakomatic1.0</title>
<HTA:APPLICATION
ID="objTweakomatic"
APPLICATIONNAME="Tweakomatic"
SCROLL="no"
SINGLEINSTANCE="yes"
WINDOWSTATE="maximize"
>
</head>
<style>
BODY
{
background-color:buttonface;
font-family:Helvetica;
font-size:8pt;
margin-top:10px;
margin-left:10px;
margin-right:10px;
margin-bottom:10px;
}
.button
{
font-family:Helvetica;
font-size:8pt;
}
textarea
{
font-family:arial;
font-size:8pt;
margin-left:3px;
}
select
{
font-family:arial;
font-size:8pt;
width:450px;
margin-left:0px;
}
td
{
font-family:arial;
font-size:10pt;
}
</style>
<SCRIPTLANGUAGE="VBScript">
ConstadOpenStatic=3
ConstadLockOptimistic=3
ConstadUseClient=3
DefaultComputer="."
MasterFile=""
RetrievalFile=""
StartHelp="Tobegin,selectamanageablecomponent,andthenselectacategoryoftasks.Whenyoudoso,asetoftaskswillbedisplayedintheTaskArea.Clickataskandtwoscriptswillautomaticallybecreated:oneforconfiguringinformation,theotherforretrievinginformation."
Help2="Selectacategoryfromthelistofcategories.Whenyoudoso,asetoftaskswillbedisplayedintheTaskArea.Clickataskandtwoscriptswillautomaticallybecreated:oneforconfiguringinformation,theotherforretrievinginformation."
Help3="Clickataskandtwoscriptswillautomaticallybecreated:oneforconfiguringinformation,theotherforretrievinginformation."
SubWindow_Onload
SetobjConnection=CreateObject("ADODB.Connection")
objConnection.Open"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=tweakomatic.mdb"
SetobjRecordset=CreateObject("ADODB.Recordset")
objRecordset.CursorLocation=adUseClient
objRecordset.Open"SELECTDISTINCTTweaks.ComponentFROMTweaksORDERBYTweaks.Component",objConnection,adOpenStatic,adLockOptimistic
objRecordSet.MoveFirst
strHTML="<selectstyle='width:460'onChange=""GetCategoryInfo()""name=ComponentList>"
strHTML=strHTML&"<optionvalue="&chr(34)&chr(34)&">"
DoUntilobjRecordSet.EOF
strHTML=strHTML&"<optionvalue="&chr(34)&_
objRecordSet.Fields.Item("Component")&chr(34)&_
">"&objRecordSet.Fields.Item("Component")
objRecordSet.MoveNext
Loop
strHTML=strHTML&"</select>"
ComponentArea.InnerHTML=strHTML
run_button.disabled=True
run_button2.disabled=True
save_button.disabled=True
save_button2.disabled=True
change_button.disabled=True
Master_button.disabled=True
Master_button2.disabled=True
show_button.disabled=True
show_button2.disabled=True
HelpArea.InnerHTML=StartHelp
EndSub
SubWindow_OnUnload
OnErrorResumeNext
SetobjFSO=CreateObject("Scripting.FileSystemObject")
objFSO.DeleteFile"temp_script.sm"
SetobjFSO=Nothing
self.Close()
EndSub
SubGetCategoryInfo()
OnErrorResumeNext
FilterValue=ComponentList.Value
SetobjConnection=CreateObject("ADODB.Connection")
objConnection.Open"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=tweakomatic.mdb"
SetobjRecordset=CreateObject("ADODB.Recordset")
objRecordset.CursorLocation=adUseClient
objRecordset.Open"SELECTDISTINCTTweaks.CategoryFROMTweaksWhereComponent='"&FilterValue&"'ORDERBYTweaks.Category",objConnection,adOpenStatic,adLockOptimistic
objRecordSet.MoveFirst
CategoryArea.InnerHTML=""
strHTML="<selectstyle='width:460'onChange=""GetTaskInfo""name=CategoryList>"
strHTML=strHTML&"<optionvalue="&chr(34)&chr(34)&">"
DoUntilobjRecordSet.EOF
strHTML=strHTML&"<optionvalue="&chr(34)&_
objRecordSet.Fields.Item("Category")&chr(34)&_
">"&objRecordSet.Fields.Item("Category")
objRecordSet.MoveNext
Loop
strHTML=strHTML&"</select>"
CategoryArea.InnerHTML=strHTML
TaskArea.InnerHTML="<selectsize='15'name='D2'>"
HelpArea.InnerHTML=Help2
ScriptArea.Value=""
RetrievalArea.Value=""
run_button.disabled=True
run_button2.disabled=True
save_button.disabled=True
save_button2.disabled=True
change_button.disabled=True
Master_button.disabled=True
Master_button2.disabled=True
objRecordSet.Close
objConnection.Close
EndSub
SubGetTaskInfo()
OnErrorResumeNext
FilterValue=ComponentList.Value
FilterValue2=CategoryList.Value
SetobjConnection=CreateObject("ADODB.Connection")
objConnection.Open"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=tweakomatic.mdb"
SetobjRecordset=CreateObject("ADODB.Recordset")
objRecordset.CursorLocation=adUseClient
objRecordset.Open"SELECTDISTINCTTweaks.TaskFROMTweaksWhereComponent='"&FilterValue&"'ANDCategory='"&FilterValue2&"'ORDERBYTweaks.Task",objConnection,adOpenStatic,adLockOptimistic
objRecordSet.MoveFirst
TaskArea.InnerHTML=""
strHTML="<selectsize='15'style='width:460'onChange=""GetHelpText()""name=TaskList>"
DoUntilobjRecordSet.EOF
strHTML=strHTML&"<optionvalue="&chr(34)&_
objRecordSet.Fields.Item("Task")&chr(34)&_
">"&objRecordSet.Fields.Item("Task")
objRecordSet.MoveNext
Loop
strHTML=strHTML&"</select>"
TaskArea.InnerHTML=strHTML
HelpArea.InnerHTML=Help3
ScriptArea.Value=""
RetrievalArea.Value=""
run_button.disabled=True
run_button2.disabled=True
save_button.disabled=True
save_button2.disabled=True
change_button.disabled=True
Master_button.disabled=True
Master_button2.disabled=True
objRecordSet.Close
objConnection.Close
EndSub
SubGetHelpText()
FilterValue=TaskList.Value
SetobjConnection=CreateObject("ADODB.Connection")
objConnection.Open"Provider=Microsoft.Jet.OLEDB.4.0;DataSource=tweakomatic.mdb"
SetobjRecordset=CreateObject("ADODB.Recordset")
objRecordset.CursorLocation=adUseClient
objRecordset.Open"SELECT*FROMTweaksWHERETask='"&FilterValue&"'ORDERBYTweaks.Task",objConnection,adOpenStatic,adLockOptimistic
objRecordSet.MoveFirst
DoUntilobjRecordSet.EOF
strHTML=objRecordSet.Fields.Item("Help")
strText2="OnErrorResumeNext"&vbCrLf
strLocation=objRecordSet.Fields.Item("RegistryLocation")
IfStrLocation="HKEY_CURRENT_USER"Then
strText="HKEY_CURRENT_USER=&H80000001"&VbCrLf
strText2=strText2&"HKEY_CURRENT_USER=&H80000001"&VbCrLf
strText=strText&"strComputer="&chr(34)&DefaultComputer&chr(34)&VbCrLf
strText2=strText2&"strComputer="&chr(34)&DefaultComputer&chr(34)&VbCrLf
strText=strText&"SetobjReg=GetObject("&chr(34)&"winmgmts:"&chr(34)
strText2=strText2&"SetobjReg=GetObject("&chr(34)&"winmgmts:"&chr(34)
strText=strText&"&strComputer&"&chr(34)&"rootdefault:StdRegProv"&chr(34)&")"&VbCrLf
strText2=strText2&"&strComputer&"&chr(34)&"rootdefault:StdRegProv"&chr(34)&")"&VbCrLf
strText=strText&"strKeyPath="&chr(34)&objRecordSet.Fields.Item("RegKey")&chr(34)&VbCrLf
strText2=strtext2&"strKeyPath="&chr(34)&objRecordSet.Fields.Item("RegKey")&chr(34)&VbCrLf
strText=strText&"objReg.CreateKey"&strLocation&",strKeyPath"&VbCrLf
strText=strText&"ValueName="&chr(34)&objRecordSet.Fields.Item("RegValue")&chr(34)&VbCrLf
strText2=strText2&"ValueName="&chr(34)&objRecordSet.Fields.Item("RegValue")&chr(34)&VbCrLf
Else
strText=strText&"HKEY_LOCAL_MACHINE=&H80000002"&vbCrLf
strText2=strText2&"HKEY_LOCAL_MACHINE=&H80000002"&vbCrLf
strText=strText&"strComputer="&chr(34)&DefaultComputer&chr(34)&VbCrLf
strText2=strText2&"strComputer="&chr(34)&DefaultComputer&chr(34)&VbCrLf
strText=strText&"SetobjReg=GetObject("&chr(34)&"winmgmts:"&chr(34)
strText2=strText2&"SetobjReg=GetObject("&chr(34)&"winmgmts:"&chr(34)
strText=strText&"&strComputer&"&chr(34)&"rootdefault:StdRegProv"&chr(34)&")"&VbCrLf
strText2=strText2&"&strComputer&"&chr(34)&"rootdefault:StdRegProv"&chr(34)&")"&VbCrLf
strText=strText&"strKeyPath="&chr(34)&objRecordSet.Fields.Item("RegKey")&chr(34)&VbCrLf
strText2=strText2&"strKeyPath="&chr(34)&objRecordSet.Fields.Item("RegKey")&chr(34)&VbCrLf
strText=strText&"objReg.CreateKey"&strLocation&",strKeyPath"&VbCrLf
strText=strText&"ValueName="&chr(34)&objRecordSet.Fields.Item("RegValue")&chr(34)&VbCrLf
strText2=strText2&"ValueName="&chr(34)&objRecordSet.Fields.Item("RegValue")&chr(34)&VbCrLf
EndIf
strValueType=objRecordSet.Fields.Item("DataType")
IfstrValueType="REG_DWORD"Then
strText=strText&"dwValue="&objRecordSet.Fields.Item("DefaultValue")&VbCrLf
strText=strText&"objReg.SetDWORDValueHKEY_CURRENT_USER,strKeyPath,ValueName,dwValue"&VbCrLf
strText2=strText2&"objReg.GetDWORDValueHKEY_CURRENT_USER,strKeyPath,ValueName,dwValue"&VbCrLf
strEcho="Wscript.Echo"&chr(34)&FilterValue&":"&chr(34)&",dwValue"&vbCrLf
Else
strText=strText&"strValue="&chr(34)&objRecordSet.Fields.Item("DefaultValue")&chr(34)&VbCrLf
strText=strText&"objReg.SetStringValueHKEY_CURRENT_USER,strKeyPath,ValueName,strValue"&VbCrLf
strText2=strText2&"objReg.GetStringValueHKEY_CURRENT_USER,strKeyPath,ValueName,strValue"&VbCrLf
strEcho="Wscript.Echo"&chr(34)&FilterValue&":"&chr(34)&",strValue"&vbCrLf
EndIf
strText2=strText2&"IfIsNull(strValue)Then"&VbCrLf
strText2=strtext2&"Wscript.Echo"&chr(34)&FilterValue&":ThevalueiseitherNullorcouldnotbefoundintheregistry."&chr(34)&VbCrLf
strText2=strText2&"Else"&vbCrLf
strText2=strText2&strEcho
strText2=strtext2&"EndIf"
objRecordSet.MoveNext
Loop
HelpArea.InnerHTML=strHTML
ScriptArea.Value=strText
RetrievalArea.Value=strText2
run_button.disabled=False
run_button2.disabled=False
save_button.disabled=False
save_button2.disabled=False
change_button.disabled=False
Master_button.disabled=False
Master_button2.disabled=False
EndSub
SubRunConfigurationScript()
SetobjFS=CreateObject("Scripting.FileSystemObject")
strTmpName="temp_script.sm"
SetobjScript=objFS.CreateTextFile(strTmpName)
objScript.WriteScriptArea.Value
objScript.Close
SetobjShell=CreateObject("WScript.Shell")
strCmdLine="wscript.exe//E:VBScript"&strTmpName
objShell.RunstrCmdLine
strAction="Configuredvaluefor"&TaskList.Value
ActionArea.InnerHTML=strAction
EndSub
SubRunRetrievalScript()
SetobjFS=CreateObject("Scripting.FileSystemObject")
strTmpName="temp_script.sm"
SetobjScript=objFS.CreateTextFile(strTmpName)
objScript.WriteRetrievalArea.Value
objScript.Close
SetobjShell=CreateObject("WScript.Shell")
strCmdLine="wscript.exe//E:VBScript"&strTmpName
objShell.RunstrCmdLine
strAction="Retrievedvaluefor"&TaskList.Value
ActionArea.InnerHTML=strAction
EndSub
SubSaveConfigurationScript()
SetobjFSO=CreateObject("Scripting.FileSystemObject")
strSaveFileName=InputBox("Pleaseenterthecompletepathwhereyouwanttosaveyourscript(forexample,C:ScriptsMyScript.vbs).")
IfstrSaveFileName=""Then
ExitSub
EndIf
SetobjFile=objFSO.CreateTextFile(strSaveFileName)
objFile.WriteLineScriptArea.Value
objFile.Close
strAction="Saved"&TaskList.Value&"to"&strSaveFileName
ActionArea.InnerHTML=strAction
EndSub
SubSaveRetrievalScript()
SetobjFSO=CreateObject("Scripting.FileSystemObject")
strSaveFileName=InputBox("Pleaseenterthecompletepathwhereyouwanttosaveyourscript(forexample,C:ScriptsMyScript.vbs).")
IfstrSaveFileName=""Then
ExitSub
EndIf
SetobjFile=objFSO.CreateTextFile(strSaveFileName)
objFile.WriteLineRetrievalArea.Value
objFile.Close
strAction="Saved"&TaskList.Value&"to"&strSaveFileName
ActionArea.InnerHTML=strAction
EndSub
SubChangeValue()
strCurrent=ScriptArea.Value
NewValue=InputBox("Pleaseenterthenewvalue:")
IfNewValue=""Then
ExitSub
EndIf
ScriptType=Split(strCurrent,vbCrLf,-1)
IfLeft(ScriptType(6),2)="dw"Then
IfNotIsNumeric(NewValue)Then
Msgbox"YoumustenteranumberwhenconfiguringDWORDregistryvalues."
ExitSub
EndIf
ScriptType(6)="dwValue="&NewValue
Else
ScriptType(6)="strValue="&chr(34)&NewValue&chr(34)
EndIf
strReplace=Join(ScriptType,vbcrlf)
ScriptArea.Value=strReplace
strAction="Changedvaluefor"&TaskList.Value&"to"&NewValue
ActionArea.InnerHTML=strAction
EndSub
SubChangeMasterFile()
IfMasterFile=""Then
strCurrentFile="Currentlyyoudonothaveanmasterscript."
Else
strCurrentFile="Yourcurrentmasterscriptis"&MasterFile&"."
EndIf
strMessage=strCurrentFile&"Pleaseenterthepathtothenewmasterscript:"
NewValue=InputBox(strMessage)
IfNewValue=""Then
ExitSub
EndIf
SetobjFSO=CreateObject("Scripting.FileSystemObject")
IfobjFSO.FileExists(NewValue)Then
MasterFile=NewValue
show_button.disabled=False
Else
CreateFile=Msgbox("Thisfiledoesnotexist.Wouldyouliketocreateit",4)
IfCreateFile=vbYesThen
objFSO.CreateTextFile(NewValue)
MasterFile=NewValue
show_button.disabled=False
EndIf
EndIf
strAction="Changednameofmasterscriptto"&NewValue
ActionArea.InnerHTML=strAction
EndSub
SubChangeRetrievalFile()
IfRetrievalFile=""Then
strCurrentFile="Currentlyyoudonothavearetrievalmasterscript."
Else
strCurrentFile="Youcurrentretrievalmasterscriptis"&RetrievalFile&"."
EndIf
strMessage=strCurrentFile&"Pleaseenterthepathtothenewretrievalmasterscript:"
NewValue=InputBox(strMessage)
IfNewValue=""Then
ExitSub
EndIf
SetobjFSO=CreateObject("Scripting.FileSystemObject")
IfobjFSO.FileExists(NewValue)Then
RetrievalFile=NewValue
show_button2.disabled=False
Else
CreateFile=Msgbox("Thisfiledoesnotexist.Wouldyouliketocreateit",4)
IfCreateFile=vbYesThen
objFSO.CreateTextFile(NewValue)
RetrievalFile=NewValue
show_button2.disabled=False
EndIf
EndIf
strAction="Changednameofretrievalmasterscriptto"&NewValue
ActionArea.InnerHTML=strAction
EndSub
SubSetComputerName()
strMessage="Curentlyyourscriptsareusing"&DefaultComputer&"asthedefaultcomputername.Pleaseenterthenewcomputername.Torunthescriptagainstthelocalcomputer,simplytypeaperiod(.)forthecomputername:"
NewValue=InputBox(strMessage)
IfNewValue=""Then
ExitSub
EndIf
DefaultComputer=NewValue
strAction="Changeddefaultcomputernameto"&NewValue
ActionArea.InnerHTML=strAction
EndSub
SubMasterConfigurationScript()
SetobjFSO=CreateObject("Scripting.FileSystemObject")
IfMasterFile=""Then
strCurrentFile="Currentlyyoudonothaveamasterscript."
strMessage=strCurrentFile&"Pleaseenterthepathtothenewmasterscript:"
NewValue=InputBox(strMessage)
IfNewValue=""Then
ExitSub
EndIf
IfobjFSO.FileExists(NewValue)Then
MasterFile=NewValue
show_button.disabled=False
Else
CreateFile=Msgbox("Thisfiledoesnotexist.Wouldyouliketocreateit",4)
IfCreateFile=vbYesThen
objFSO.CreateTextFile(NewValue)
MasterFile=NewValue
show_button.disabled=False
Else
ExitSub
EndIf
EndIf
EndIf
SetobjFile=objFSO.OpenTextFile(MasterFile,8)
objFile.WriteLineChr(39)&""&TaskList.Value
objFile.WriteLineScriptArea.Value
objFile.WriteLinevbCrLf&vbCrLf
objFile.Close
strAction="Appended"&TaskList.Value&"to"&MasterFile
ActionArea.InnerHTML=strAction
EndSub
SubMasterRetrievalScript()
SetobjFSO=CreateObject("Scripting.FileSystemObject")
IfRetrievalFile=""Then
strCurrentFile="Currentlyyoudonothavearetrievalmasterscript."
strMessage=strCurrentFile&"Pleaseenterthepathtothenewmasterscript:"
NewValue=InputBox(strMessage)
IfNewValue=""Then
ExitSub
EndIf
IfobjFSO.FileExists(NewValue)Then
RetrievalFile=NewValue
show_button2.disabled=False
Else
CreateFile=Msgbox("Thisfiledoesnotexist.Wouldyouliketocreateit",4)
IfCreateFile=vbYesThen
objFSO.CreateTextFile(NewValue)
RetrievalFile=NewValue
show_button2.disabled=False
Else
ExitSub
EndIf
EndIf
EndIf
SetobjFile=objFSO.OpenTextFile(RetrievalFile,8)
objFile.WriteLineChr(39)&""&TaskList.Value
objFile.WriteLineRetrievalArea.Value
objFile.WriteLinevbCrLf&vbCrLf
objFile.Close
strAction="Appended"&TaskList.Value&"to"&RetrievalFile
ActionArea.InnerHTML=strAction
EndSub
SubShowConfigurationScript()
SetobjShell=CreateObject("WScript.Shell")
strCmdLine="notepad.exe"&MasterFile
objShell.RunstrCmdLine
strAction="Openedfile"&MasterFile&"inNotepad"
ActionArea.InnerHTML=strAction
EndSub
SubShowRetrievalScript()
SetobjShell=CreateObject("WScript.Shell")
strCmdLine="notepad.exe"&RetrievalFile
objShell.RunstrCmdLine
strAction="Openedfile"&RetrievalFile&"inNotepad"
ActionArea.InnerHTML=strAction
EndSub
</SCRIPT>
<body>
<BR>
<tableborder="0"cellspacing="1"width="100%"id="AutoNumber1">
<tr>
<tdwidth="50%"><b>Selectamanageablecomponentfromthislist</b>
</td>
<tdwidth="50%"><b>Selectataskcategoryfromthislist</b>
</td>
</tr>
<tr>
<tdwidth="50%">
<spanid="ComponentArea"></span>
</td>
<tdwidth="50%"><spanid="CategoryArea"><selectsize="1"name="D1"></select></span></td>
</tr>
</table>
<BR>
<tableborder="0"cellspacing="1"width="100%"id="AutoNumber2">
<tr>
<tdwidth="50%"><b>Selectanindividualtaskfromthislist</b>
</td>
<tdwidth="50%"><b>Taskdescription</b>
</td>
</tr>
<tr>
<tdwidth="50%"><spanid="TaskArea"><selectsize="15"name="D2"></span></td>
<tdwidth="50%"valign="top"><fontcolor="navy"><spanid="HelpArea"></span></font></td>
</tr>
</table>
<BR>
<tableborder="0"cellspacing="1"width="100%"id="AutoNumber3">
<tr>
<tdwidth="50%"><b>Scriptforcarryingoutthistask</b>
</td>
<tdwidth="50%"><b>Scriptforretrievingthecurrenttasksetting</b>
</td>
</tr>
<tr>
<tdwidth="50%">
<textarearows="12"name="ScriptArea"cols="90"></textarea></td>
<tdwidth="50%">
<textarearows="12"name="RetrievalArea"cols="90"></textarea></td>
</tr>
</table>
<BR>
<tableborder="0"cellspacing="1"width="100%"id="AutoNumber2">
<tr>
<tdwidth="50%"><inputid=runbuttonclass="button"type="button"value="RunScript"name="run_button"onClick="RunConfigurationScript()"><inputid=runbuttonclass="button"type="button"value="SaveScript"name="save_button"onClick="SaveConfigurationScript()"><inputid=runbuttonclass="button"type="button"value="ChangeValue"name="change_button"onClick="ChangeValue()"><inputid=runbuttonclass="button"type="button"value="MasterScript"name="Master_button"onClick="MasterConfigurationScript()"><inputid=runbuttonclass="button"type="button"value="ShowScript"name="show_button"onClick="ShowConfigurationScript()"></td>
<tdwidth="50%"><inputid=runbuttonclass="button"type="button"value="RunScript"name="run_button2"onClick="RunRetrievalScript()"><inputid=runbuttonclass="button"type="button"value="SaveScript"name="save_button2"onClick="SaveRetrievalScript()"><inputid=runbuttonclass="button"type="button"value="MasterScript"name="Master_button2"onClick="MasterRetrievalScript()"><inputid=runbuttonclass="button"type="button"value="ShowScript"name="show_button2"onClick="ShowRetrievalScript()"></td>
</tr>
</table>
<BR>
<tableborder="0"cellspacing="1"width="100%"id="AutoNumber2">
<tr>
<tdwidth="100%"><br><b>TweakomaticOptions</b><inputid=runbuttonclass="button"type="button"value="SetComputerName"name="computer_name"onClick="SetComputerName()"><inputid=runbuttonclass="button"type="button"value="SetConfigurationMasterScript"name="set_Master_file"onClick="ChangeMasterFile()"><inputid=runbuttonclass="button"type="button"value="SetRetrievalMasterScript"name="set_retrieval_button"onClick="ChangeRetrievalFile()"></td>
</tr>
<tr>
<tdwidth="100%"><br><b>LastAction:</b><spanid="ActionArea"></span></td>
</tr>
</table>
</body>
</html>
下载此文件
【tweakomatic hta 下载】相关文章:
★ 如何使一个HTA位于屏幕中心(Win32_DesktopMonitor)
★ A notepad made in HTA(hta实现的记事本)