|
本帖最后由 lxcai369 于 2022-4-2 10:24 编辑
我自己尝试做了一个激活工具,目的是在输入框输入一个数值选取active文本里的激活码进行系统激活
目前运行发现无法读取输入框的数值,且最终运行结果是:“错误,无法找到产品”。应该怎么改才能读到?
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Windows Active 3.0 by Chun", 282, 176, 192, 124)
$Button1 = GUICtrlCreateButton("激活系统", 152, 88, 105, 65)
$Button2 = GUICtrlCreateButton("卸载激活", 18, 88, 105, 65)
$Input1 = GUICtrlCreateInput("0", 80, 16, 121, 40, $ES_NUMBER)
GUISetState(@SW_SHOW)
#EndRegi1n ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Form1
Case $Form1
Case $Form1
Case $Form1
Case $Input1
Local $lineNum = GUICtrlRead($Input1)
Case $Button1
$Key = FileReadLine("active.txt", $lineNum)
$kms = "kms.xspace.in"
RunWait(@ComSpec & ' /c ' & 'cscript //Nologo %windir%\system32\slmgr.vbs -upk', '', 0)
RunWait(@ComSpec & ' /c ' & 'cscript //Nologo %windir%\system32\slmgr.vbs /ipk ' & $Key, '', 0)
RunWait(@ComSpec & ' /c ' & 'cscript //Nologo %windir%\system32\slmgr.vbs /skms ' & $kms, '', 0)
RunWait(@ComSpec & ' /c ' & 'cscript //Nologo %windir%\system32\slmgr.vbs /ato > %SystemDrive%\KMS.log', '', 0)
RunWait(@ComSpec & ' /c ' & ' schtasks /delete /tn KMS_T /f', '', 0)
$ReturnKMS = FileRead(@HomeDrive & "\kms.log")
If StringInStr($ReturnKMS, "找不到产品") Then
MsgBox(64, "", "$key")
Else
MsgBox(64, "$key", "$key!请检查网络畅通或稍后再次尝试激活。")
EndIf
Case $Button2
RunWait(@ComSpec & ' /c ' & ' cscript //Nologo %windir%\system32\slmgr.vbs /upk', '', 0)
RunWait(@ComSpec & ' /c ' & ' cscript //Nologo %windir%\system32\slmgr.vbs /ckms', '', 0)
RunWait(@ComSpec & ' /c ' & ' cscript //Nologo %windir%\system32\slmgr.vbs /rearm', '', 0)
RunWait(@ComSpec & ' /c ' & ' schtasks /delete /tn KMS_T /f', '', 0)
RunWait(@ComSpec & ' /c ' & ' del /q /f ' & @WindowsDir & '\KMS.exe', '', 0)
MsgBox(0, "成功", "卸载服务成功。")
EndSwitch
WEnd
|
|