|
#region AutoIt3Wrapper 预编译参数(常用参数)
#AutoIt3Wrapper_Icon= ;图标,支持EXE,DLL,ICO
#AutoIt3Wrapper_OutFile= ;输出文件名
#AutoIt3Wrapper_OutFile_Type=exe ;文件类型
#AutoIt3Wrapper_Compression=4 ;压缩等级
#AutoIt3Wrapper_UseUpx=y ;使用压缩
#AutoIt3Wrapper_Res_Comment= ;注释
#AutoIt3Wrapper_Res_Description= ;详细信息
#AutoIt3Wrapper_Res_Fileversion= ;文件版本
#AutoIt3Wrapper_Res_FileVersion_AutoIncrement=p ;自动更新版本
#AutoIt3Wrapper_Res_LegalCopyright= ziyouren ;
#AutoIt3Wrapper_Change2CUI=N ;修改输出的程序为CUI(控制台程序)
;#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 版本:
脚本作者:自由人:QQ :386263723
Email:
QQ/TM:
脚本版本:
脚本功能:fba文件安装工具
#ce _______________脚本开始_________________
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=i:\form1.kxf
Dim $Drive, $Var, $i, $HDD
$Drive = DriveGetDrive("REMOVABLE")
If Not @error Then
For $i = 1 To $Drive[0]
$Var = $Var & StringUpper($Drive[$i]) & "|"
Next
Else
MsgBox(0, 0, "无")
Exit
EndIf
$Form1 = GUICreate("自由人制作U盘安装程序", 401, 405, 501, 160)
$Pic1 = GUICtrlCreatePic("I:\ziyouren.jpg", 0, 0, 400, 50)
$Group1 = GUICtrlCreateGroup("请选择要安装的磁盘", 32, 104, 345, 81)
$Combo1 = GUICtrlCreateCombo("", 56, 136, 297, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($Combo1, $Var, StringUpper($Drive[1]))
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Group3 = GUICtrlCreateGroup("请选择要安装的模式", 32, 208, 345, 81)
$Combo3 = GUICtrlCreateCombo("", 56, 240, 297, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetData($Combo3, "USB-HDD|USB-ZIP", "USB-HDD")
GUICtrlCreateGroup("", -99, -99, 1, 1)
$Button1 = GUICtrlCreateButton("安装", 32, 344, 81, 41)
$Button2 = GUICtrlCreateButton("初始化U盘", 144, 344, 113, 41)
$Button3 = GUICtrlCreateButton("退出", 288, 344, 89, 41)
$Progress1 = GUICtrlCreateProgress(32, 304, 345, 25)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $Button3
Exit
Case $Button2
$YN = MsgBox(49, "警告", "这个操作将会把你的U盘数据全部清空!如确定将"&
"格式化U盘,按确定,否则按取消.")
$T0 = GUICtrlRead($Combo1)
$T1 = GUICtrlRead($Combo3)
Parser_File($T0, $T1, 1)
Case $Combo3
$T0 = GUICtrlRead($Combo1)
$T1 = GUICtrlRead($Combo3)
Parser_File($T0, $T1, 0)
EndSwitch
WEnd
Func Parser_File($a, $b, $c)
Select
Case $c = 1
If $b = "USB-HDD" Then
$usb = "--fat32"
EndIf
If $b = "USB-ZIP" Then
$usb = "--ZIP --fat16"
EndIf
$array = StringSplit($Var, "|", 1)
For $j = 1 To $array[0]
If $a = $array[$j] Then
$HDD = $j
EndIf
Next
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button3, $GUI_DISABLE)
GUICtrlSetData($Progress1, 25)
install()
; GUICtrlSetData($Tip, "当前状态:正在将引导程序写入U盘中,请稍
候...")
RunWait('cmd.exe /c ' & @WindowsDir & "\fbinst (hd" & $HDD & ")
format --raw --force", @WindowsDir, @SW_HIDE)
GUICtrlSetData($Progress1, 50)
; GUICtrlSetData($Tip, "当前状态:正在准备U盘PE数据和必备文件中
,请稍候...") ; extended 60M 这里是UD大小,根据FBA文件自行调整
RunWait('cmd.exe /c ' & @WindowsDir & "\fbinst (hd" & $HDD & ")
format --force" & $usb & "--primary 11M --extended 60M --align", @WindowsDir, @SW_HIDE)
GUICtrlSetData($Progress1, 75)
; GUICtrlSetData($Tip, "当前状态:正在将PE维护系统数据写入U盘中
,请稍候...")
RunWait('cmd.exe /c ' & @WindowsDir & "\fbinst.exe (hd" & $HDD & ")
load ziyouren.fba", @WindowsDir, @SW_HIDE)
GUICtrlSetData($Progress1, 100)
; GUICtrlSetData($Tip, "当前状态:所有任务全部完成!")
MsgBox(0, "提示", "U盘启动盘制作成功" & @CRLF & @CRLF & "请安全移除U盘
并重新接上")
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
DEL()
; GUICtrlSetData($Tip, "当前状态:等待用户确认设置开始制作...")
Case $c = 0
$array = StringSplit($Var, "|", 1)
For $j = 1 To $array[0]
If $a = $array[$j] Then
$HDD = $j
EndIf
Next
GUICtrlSetState($Button1, $GUI_DISABLE)
GUICtrlSetState($Button2, $GUI_DISABLE)
GUICtrlSetState($Button3, $GUI_DISABLE)
GUICtrlSetData($Progress1, 10)
install()
; GUICtrlSetData($Tip, "当前状态:正在重置U盘中,请稍候
...")
RunWait('cmd.exe /c ' & @WindowsDir & "\fbinst.exe (hd" & $HDD & ")
format --force --raw", @WindowsDir, @SW_HIDE)
Sleep(1000)
GUICtrlSetData($Progress1, 100)
MsgBox(0, "提示", "成功将U盘重置为未制作前的状态!" & @CRLF & @CRLF &
"请安全移除U盘并重新接上")
GUICtrlSetState($Button1, $GUI_ENABLE)
GUICtrlSetState($Button2, $GUI_ENABLE)
GUICtrlSetState($Button3, $GUI_ENABLE)
; GUICtrlSetData($Tip, "当前状态:等待用户确认设置开始制作...")
DEL()
EndSelect
EndFunc ;==>Parser_File
Func quit()
GUISetState(@SW_HIDE)
FileDelete(@WindowsDir & "\fbinst.exe")
FileDelete(@WindowsDir & "\ziyouren.fba")
Exit
EndFunc ;==>quit
Func install()
FileInstall("fbinst.exe", @WindowsDir & "\fbinst.exe", 1)
FileInstall("ziyouren.fba", @WindowsDir & "\ziyouren.fba", 1)
EndFunc ;==>install
Func DEL()
FileDelete(@WindowsDir & "\fbinst.exe")
FileDelete(@WindowsDir & "\ziyouren.fba")
EndFunc ;==>DEL
[ 本帖最后由 2011ziyouren 于 2011-12-4 14:57 编辑 ] |
|