无忧启动论坛

 找回密码
 注册
搜索
系统gho:最纯净好用系统下载站投放广告、加入VIP会员,请联系 微信:wuyouceo
查看: 2244|回复: 0
打印 上一主题 下一主题

[已解决] 哪位高手帮我编写成,不盛感激

[复制链接]
跳转到指定楼层
1#
发表于 2011-11-30 15:19:30 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
本帖最后由 2011ziyouren 于 2013-12-7 07:41 编辑

#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
$Form1 = GUICreate("自由人制作U盘安装程序", 401, 405, 501, 160)
$Pic1 = GUICtrlCreatePic("I:\ziyouren.jpg", 0, 0, 400, 50)
$Group1 = GUICtrlCreateGroup("请选择要安装的磁盘", 32, 104, 345, 81)
$Combo1 = GUICtrlCreateCombo("Combo1", 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("Combo3", 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 $Button1
           $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盘中,请稍候...")
_RunDOS(@WindowsDir&"\fbinst (hd"&$HDD&") format --raw --force")
GUICtrlSetData($Progress1, 50)
GUICtrlSetData($Tip,"当前状态:正在准备U盘PE数据和必备文件中,请稍候...")
_RunDOS(@WindowsDir&"\fbinst (hd"&$HDD&") format --force"&$usb&"--primary 11M --extended 60M --align")
GUICtrlSetData($Progress1, 75)
GUICtrlSetData($Tip,"当前状态:正在将PE维护系统数据写入U盘中,请稍候...")
_RunDOS(@WindowsDir&"\fbinst (hd"&$HDD&") load *.fba")
GUICtrlSetData($Progress1, 100)
GUICtrlSetData($Tip,"当前状态:所有任务全部完成!")
MsgBox(0,"提示","U盘启动盘制作成功"[email=&@CRLF&@CRLF]&@CRLF&@CRLF[/email]&"请安全移除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盘中,请稍候...")
_RunDOS(@WindowsDir&"\fbinst (hd"&$HDD&") format --force --raw")
Sleep(1000)
GUICtrlSetData($Progress1, 100)
MsgBox(0,"提示","成功将U盘重置为未制作前的状态!"[email=&@CRLF&@CRLF]&@CRLF&@CRLF[/email]&"请安全移除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&"\*.fba")
Exit
EndFunc ;==>quit
Func install()
FileInstall("fbinst.exe", @WindowsDir&"\fbinst.exe", 1)
FileInstall("*.fba", @WindowsDir&"\*.fba", 1)
EndFunc ;==>ixnstall
Func DEL()
FileDelete(@WindowsDir&"\fbinst.exe")
FileDelete(@WindowsDir&"\*.fba")
EndFunc ;==>DEL

[ 本帖最后由 2011ziyouren 于 2011-12-2 10:24 编辑 ]
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|捐助支持|无忧启动 ( 闽ICP备05002490号-1 )

闽公网安备 35020302032614号

GMT+8, 2024-11-17 16:27

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表