#NoTrayIcon
#region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=E:\U盘+光盘工具\多功能u盘系统\U 盘维护系统.exe|-1
#AutoIt3Wrapper_outfile=I:\U盘微型系统\U盘fbinst安装工具.exe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_Res_Description=fba文件安装自由人制作
#AutoIt3Wrapper_Res_Fileversion=没有版权QQ:386263723
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p
#AutoIt3Wrapper_Res_LegalCopyright=seniors
#endregion ;**** 参数创建于 ACNWrapper_GUI ****
#region AutoIt3Wrapper 预编译参数(常用参数)
#AutoIt3Wrapper_UseAnsi=N ;编码
;#AutoIt3Wrapper_Res_Field=AutoIt Version|%AutoItVer% ;自定义资源段
;#AutoIt3Wrapper_Run_Tidy= ;脚本整理
;#AutoIt3Wrapper_Run_Obfuscator= ;代码迷惑
;#AutoIt3Wrapper_Run_AU3Check= ;语法检查
;#AutoIt3Wrapper_Run_Before= ;运行前
;#AutoIt3Wrapper_Run_After= ;运行后
#endregion AutoIt3Wrapper 预编译参数(常用参数)
#cs ____________________________________
Au3 版本:
脚本作者:
Email:
QQ/TM:
脚本版本:
脚本功能:
#ce _______________脚本开始_________________
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ComboConstants.au3>
#include <Array.au3>
#include <EditConstants.au3>
#region ### START Koda GUI section ### Form=
Global $sTitle = '自由人制作U盘启动安装程序UD和U+版二合一'
FileInstall("c:\Program Files\fbinst.exe", @TempDir & "\fbinst.exe")
FileInstall("c:\Program Files\ziyouren.jpg", @TempDir & "\ziyouren.jpg")
Global $usl = 0
Global $total = 0
Global $upan = ""
Global $fba = 0
Global $rd[8] = [0, 0, 0, 0, 0, 0, 0, 0]
Global $rdn = $rd
Global $msg[6] = ["■", "■ ■", "■ ■ ■", "■ ■ ■ ■", "■ ■ ■ ■ ■", "■ ■ ■ ■ ■ ■"]
Global $ok = 0
$hGui = GUICreate($sTitle, 400, 400, -1, -1)
GUICtrlCreateLabel("___________________________________________________________________", 0, 216, 400, 12)
GUICtrlSetState(-1, $GUI_DISABLE)
GUICtrlSetFont(-1, 16, 100, 0, "宋体")
GUICtrlSetState(-1, $GUI_DISABLE)
$info = GUICtrlCreateLabel("特别鸣谢:afan seniors poiu xiehuahere …… 等好友", 16, 380, 380, 21)
GUICtrlSetColor(-1, 0xee3344)
GUICtrlCreatePic(@TempDir & "\1.jpg", 0, 0, 400, 60)
GUICtrlCreateGroup("磁盘选项", 6, 120, 388, 98)
GUICtrlCreateLabel("可移动磁盘选择:", 16, 145, 100, 17)
DllCall('user32.dll', 'int', 'AnimateWindow', 'hwnd', $hGui, 'int', 1000, 'long', 0x40010)
GUISetState()
$List1 = GUICtrlCreateCombo("", 120, 145, 80, 32, $CBS_DROPDOWNLIST)
$selectupan = GUICtrlCreateButton("刷新磁盘列表", 210, 140, 80, 30)
$openupan = GUICtrlCreateButton("打开磁盘", 300, 140, 80, 30)
$emotin = GUICtrlCreateLabel("", 16, 170, 370, 17)
GUICtrlSetBkColor(-1, 0x00000)
GUICtrlSetColor(-1, 0xee3344) ;red
GUICtrlSetFont(-1, 9, 600)
$kongjian = GUICtrlCreateLabel("", 16, 190, 370, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
GUICtrlCreateGroup("备份文件选项", 6, 224, 388, 72)
$List2 = GUICtrlCreateCombo("", 16, 250, 365, 32, $CBS_DROPDOWNLIST)
$search = FileFindFirstFile("*.fba")
If $search = -1 Then
MsgBox(0, "", "当前目录没有fba文件,请手动添加fba文件!", 3)
EndIf
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
GUICtrlSetData(-1, $file)
WEnd
FileClose($search)
$fbasize = GUICtrlCreateLabel("安装启动请选择fba文件", 16, 279, 160, 17)
$addfba = GUICtrlCreateButton("手动添加fba文件", 280, 274, 100, 20)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$clearupan = GUICtrlCreateButton("U盘清除启动", 16, 320, 100, 30)
$instupan = GUICtrlCreateButton("U盘安装启动项", 280, 320, 100, 30)
$instiso = GUICtrlCreateButton("制作iso模式", 150, 320, 100, 30)
$djsw = GUICtrlCreateButton("Autoit3中文网", 300, 70, 90, 30)
genxing()
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
Local $isoPath = (@ScriptDir & "\ziyouren.iso")
$search = FileFindFirstFile("ziyouren.iso")
If $search = -1 Then
MsgBox(0, "", "当前目录没有ziyouren.iso文件!", 5)
Exit
EndIf
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
DllCall('user32.dll', 'int', 'AnimateWindow', 'hwnd', $hGui, 'int', 1000, 'long', 0x50010)
GUISetState()
FileDelete(@ScriptDir & "\UltraISO.exe")
FileDelete(@TempDir & "\ziyouren.jpg")
FileDelete(@TempDir & "\fbinst.exe")
leave()
Case $djsw
ShellExecute("http://www.autoitx.com/index.php") ;利用本机默认浏览器运行网页。
Case $List1
kongjian()
Case $instiso
FileInstall("c:\Program Files\UltraISO.exe",@ScriptDir & "\UltraISO.exe", 1)
Run(@ScriptDir & "\UltraISO.exe")
WinWait("UltraISO")
If Not WinActive("UltraISO") Then WinActivate("UltraISO")
Send("!f")
Send('{{down}{down}')
Send('{enter}')
WinWait("打开 ISO 文件")
If Not WinActive("打开 ISO 文件") Then WinActivate("打开 ISO 文件")
ControlSetText("打开 ISO 文件", "", "Edit1", $isoPath)
Send("!o")
;ControlClick("打开 ISO 文件", "", "Button2") ;Open
WinWait("UltraISO")
If Not WinActive("UltraISO") Then WinActivate("UltraISO")
Send('!B')
Send('{down}{down}{down}')
Send('{enter}')
WinWait('写入硬盘映像')
ControlClick("写入硬盘映像", "", "[CLASS:TComboBox; INSTANCE:1]", "left", 1, 137, 20)
Send('{down}{down}')
Send('{enter}')
MsgBox(49, "", "自由人温馨提示,点击写入!")
Case $List2
fbas()
Case $selectupan
genxing()
Case $openupan
If $upan <> "" Then
ShellExecute($upan)
EndIf
Case $addfba
wenjian()
Case $clearupan
If GUICtrlRead($List1) = "" Then
MsgBox(0, "", "请选择U盘!", 2)
Else
$YN = MsgBox(49, "警告", "这个操作将会把你的U盘数据全部清空!如确定将" & GUICtrlRead($List1) & "清除ud分区,按确定,否则按取消.")
If $YN == 1 Then
GUISetState(@SW_DISABLE)
AdlibRegister("install")
RunWait(@ComSpec & " /c " & @TempDir & "\fbinst.exe " & GUICtrlRead($List1) & " format --raw --force", "", @SW_HIDE)
AdlibUnRegister("install")
GUISetState(@SW_ENABLE)
GUICtrlSetData($info, "☆ 欢 迎 使 用 ☆")
MsgBox(0, "", "U盘清除启动成功!")
EndIf
EndIf
Case $instupan
If GUICtrlRead($List1) = "" Then
MsgBox(0, "", "请选择U盘!", 2)
Else
If StringInStr(GUICtrlRead($List2), "fba") == 0 Then
MsgBox(0, "", "请选择fba文件!", 2)
Else
If $total < $fba Then
MsgBox(0, "", "您的U盘空间不够安装这个fba文件启动项项目!", 2)
Else
$YN = MsgBox(49, "警告", "这个操作将会把你的U盘数据全部清空!如确定要在" & GUICtrlRead($List1) & "安装启动,按确定,否则按取消.")
If $YN == 1 Then
GUISetState(@SW_DISABLE)
AdlibRegister("install")
RunWait(@ComSpec & " /c " & @TempDir & "\fbinst.exe " & GUICtrlRead($List1) & " format --archive " & GUICtrlRead($List2) & " --force", "", @SW_HIDE)
AdlibUnRegister("install")
GUISetState(@SW_ENABLE)
GUICtrlSetData($info, "☆ 欢 迎 使 用 ☆")
MsgBox(0, "", "安装启动成功!")
EndIf
EndIf
EndIf
EndIf
EndSwitch
WEnd
Func wenjian()
$var = FileOpenDialog("添加fba文件", @ScriptDir & "", "Fb备份文件(*.fba)", 1)
If @error Then
MsgBox(4096, "", "没有选择文件!")
Else
$var = StringReplace($var, "|", @CRLF)
GUICtrlSetData($List2, $var)
EndIf
EndFunc ;==>wenjian
Func genxing()
$usl = 0
GUICtrlSetData($List1, "")
GetPartionMsg("USB")
If $usl = 0 Then
$rd = $rdn
Else
For $i = 1 To $usl
$rd[$i] = StringUpper($rd[$i])
GUICtrlSetData($List1, $rdn[$i])
Next
EndIf
kongjian()
EndFunc ;==>genxing
Func kongjian()
$upan = ""
If GUICtrlRead($List1) <> "" Then
For $i = 1 To $usl
If GUICtrlRead($List1) == $rdn[$i] Then
$upan = $rd[$i]
$total = DriveSpaceTotal($rd[$i])
$free = DriveSpaceFree($rd[$i])
If $total == $free Then
GUICtrlSetData($emotin, $rdn[$i] & "就是盘符" & $rd[$i] & " 磁盘为空,可以放心安装")
Else
GUICtrlSetData($emotin, $rdn[$i] & "就是盘符" & $rd[$i] & " 磁盘有内容,请确认内容已经不重要!")
EndIf
GUICtrlSetData($kongjian, "U盘容量:" & CalcG($total) & ", 已用空间:" & CalcG($total - $free))
ExitLoop
EndIf
Next
Else
GUICtrlSetData($emotin, "请插入U盘后按刷新磁盘列表!")
GUICtrlSetData($kongjian, "现在还没选择盘符!")
EndIf
EndFunc ;==>kongjian
Func fbas()
$fba = FileGetSize(GUICtrlRead($List2)) / 1048576
GUICtrlSetData($fbasize, "注意fba文件大小: " & CalcG($fba))
EndFunc ;==>fbas
Func leave()
;$YN = MsgBox(49, "退出", "确定要退出吗?")
If $YN == 1 Then
If FileExists(@TempDir & "\fbinst.exe") Then
FileDelete(@TempDir & "\fbinst.exe")
EndIf
If FileExists(@TempDir & "\1.jpg") Then
FileDelete(@TempDir & "\1.jpg")
EndIf
Exit
EndIf
EndFunc ;==>leave
Func install()
If $ok > 5 Then
$ok = 0
EndIf
GUICtrlSetData($info, "耐心等待 " & $msg[$ok])
$ok += 1
EndFunc ;==>install
Func GetPartionMsg($Interface)
$objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_LogicalDiskToPartition")
For $objItem In $colItems
$DiskFH = StringLeft(StringRight($objItem.Dependent, 3), 2)
$PartNum = QueryDiskNum($DiskFH)
If StringMid($PartNum, 2, 3) = $Interface Then
$usl += 1
$rdn[$usl] = "(" & StringMid($PartNum, 6)
$rd[$usl] = $DiskFH
EndIf
Next
EndFunc ;==>GetPartionMsg
Func QueryDiskInterface($n)
$objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
$colItems = $objWMIService.ExecQuery("Select * from Win32_DiskDrive Where Index=" & $n)
For $objItem In $colItems
Return $objItem.InterfaceType
Next
EndFunc ;==>QueryDiskInterface
Func QueryDiskNum($d)
$objWMIService = ObjGet("winmgmts:\\.\root\cimv2")
$colItems = $objWMIService.ExecQuery("Associators of {win32_LogicalDisk.DeviceID='" & $d & "'} where ResultClass = Win32_DiskPartition")
For $colItem In $colItems
Return "(" & QueryDiskInterface($colItem.DiskIndex) & ":hd" & $colItem.DiskIndex & ")"
Next
EndFunc ;==>QueryDiskNum
Func CalcG($n)
If $n < 1024 Then
Return Int($n) & "MB"
ElseIf $n < 1048576 Then
Return Round($n / 1024, 2) & "GB"
EndIf
EndFunc ;==>CalcG