#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#AutoIt3Wrapper_icon=HardDrive.Ico
#AutoIt3Wrapper_outfile=Detect.eXe
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=N
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#Region ;**** 参数创建于 ACNWrapper_GUI **** ===== 开始 =====
#AutoIt3Wrapper_UseAnsi=N ;不使用ANSI编码 -> 3.3以后版本如使用[Y]则编译时会出错喔...
#EndRegion ;**** 参数创建于 ACNWrapper_GUI **** ===== 结束 =====
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;预定刷新系统代码, 在刷新图标时会用到:
;DllCall('Shell32.Dll','None','SHChangeNotify','Int',0x08000000,'Int',0x00000000 + 0x00001000,'Ptr',0,'Ptr',0)
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;循环判断代码, 在指定时间内等待目标窗口并对其操作, 好处是超时会自动退出:
#Cs
$WinTitle = ''
$WinText = ''
$Time=0
While WinActivate($WinTitle,$WinText) = False
If $Time <= 15000 Then
Sleep(250)
$Time=$Time+250
Else
WinActivate($WinTitle,$WinText)
ExitLoop
EndIf
WEnd
#Ce
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;特殊对话框图标参数
;308 警告图标 按钮:是/否, 默认按钮:否 ║ 276 错误图标 按钮:是/否, 默认按钮:否
;305 警告图标 按钮:确定/取消 默认按钮:取消 ║ 273 错误图标 按钮:确定/取消 默认按钮:取消
;292 询问图标 按钮:是/否, 默认按钮:否 ║ 324 信息图标 按钮:是/否, 默认按钮:否
;289 询问图标 按钮:确定/取消 默认按钮:取消 ║ 321 信息图标 按钮:确定/取消 默认按钮:取消
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;FileCreateShortCut($ExeFile,@DesktopCommonDir&'\*.Lnk',@ScriptDir,$InfoTip,$ExeFile,0,@Sw_MaxiMize)
;创建快捷方式函数(源程序(全路径)文件名,桌面/[当前/所有用户]开始菜单程序组(全路径)快捷方式名称.Lnk,工作目录,参数,描述,图标,图标索引编号,窗口运行状态[常规/最大/最小化])
;+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
;脚本开始 → 请在这下面添加您的代码:
#InClude <File.Au3>
;=========== 取本机磁盘分区及空间资料 =============
Global $DwptW=@TempDir&'\DsptW.eXe'
Global $ShowDrive=@TempDir&'\ShowDrive.eXe'
Global $Part=@TempDir&'\Part.Txt'
Global $Pan=@TempDir&'\Pan.Txt'
Global $GhostIni=@TempDir & "\Ghost.InI"
Global $W=@DesktopWidth
Global $H=@DesktopHeight
Global $X=$W/2
Global $Y=$H/2
If FileExists($GhostIni) Then FileDelete($GhostIni)
If FileExists($Part) Then FileDelete($Part)
ToolTip('正在获取本地磁盘分区信息, 请稍候!',@DesktopWidth - 10, @DesktopHeight - 60,'正在智能判断本地磁盘分区:',1,6)
FileInstall('showdisk\ShowDrive.Vxd',$ShowDrive,1)
RunWait($ShowDrive&' /S','',@Sw_Hide)
FileDelete($ShowDrive)
FileInstall('showdisk\DsptW.Vxd',$DwptW,1)
RunWait(@ComSpec&' /C '&$DwptW&' 0 /L >'&$Part,'',@Sw_Hide)
$SerailNumber=StringMid(FileReadLine($Part,3),59)
FileDelete($Part)
RunWait(@ComSpec & ' /c ' & $DwptW &' /A /PDR >' & $Pan, @TempDir, 0)
$str = FileRead($Pan)
$sR = StringRegExp($str, '([C-Z]:)\t(\d:\d+)\h*\tA\t', 3)
$sR = StringRegExp($str, '([C-Z]:)\t(\d:\d+)', 3)
If IsArray($sR) Then
for $i = 0 to UBound($sR)-2 Step 2
If StringInStr($sR[$i], 'C') Then $drvh = $sR[$i+1]
Next
EndIf
For $i=1 To 26
RunWait(@ComSpec&' /C '&$DwptW&' '&$i&' /Find:All /GhostStyle >>'&$Part,'',@Sw_Hide)
If StringInStr(FileRead($Part),'Error') Then ExitLoop
Next
FileDelete($DwptW)
Dim $v
_FileReadToArray($Part,$v)
FileWrite($GhostIni,'[HardDisk]')
IniWrite($GhostIni,'HardDisk','HDD-SN',$SerailNumber)
For $i=1 To $v[0]
$ReadLine=FileReadLine($Part,$i)
If StringInStr($ReadLine,'Error') Then ExitLoop
If Not StringInStr($ReadLine,'No.') And StringInStr($ReadLine,':') Then
$GhostStr=StringLeft($ReadLine,3)&'='&StringMid($ReadLine,6,2)
If StringMid($GhostStr,1,1)=1 And StringMid($ReadLine,6,2)=' ' Then
FileWriteLine($GhostIni,StringReplace($GhostStr&'C:',' ',''))
Else
FileWriteLine($GhostIni,$GhostStr)
EndIf
ExitLoop
EndIf
Next
For $i=1 To $v[0]
$ReadLine=FileReadLine($Part,$i)
If StringInStr($ReadLine,'Error') Then ExitLoop
If Not StringInStr($ReadLine,'No.') And StringInStr($ReadLine,':') Then
$GhostStr=StringLeft($ReadLine,3)&'='&StringMid($ReadLine,6,2)
If StringMid($ReadLine,6,2)<>'' And Not StringInStr($GhostStr,'1:1') Then FileWriteLine($GhostIni,$GhostStr)
EndIf
Next
FileDelete($Part)
_FileReadToArray($GhostIni,$v)
For $i=2 To $v[0]
$ReadLine=StringLeft(FileReadLine($GhostIni,$i),3)
If StringLeft($ReadLine,1)=1 Then
FileWriteLine($GhostIni,'LoadP='&$ReadLine)
ExitLoop
EndIf
Next
$Var=IniReadSection($GhostIni,'HardDisk')
For $i = 1 To $Var[0][0]
$GetLastP=StringMid($Var[$i][0],1,1)
If StringInStr($GetLastP,'H') Then $GetLastP=StringMid($Var[$i+1][0],1,1)
If $GetLastP<>1 Then
; MsgBox(262144, '', '键: ' & $Var[$i-1][0])
FileWriteLine($GhostIni,'LastP='&$Var[$i-1][0])
ExitLoop
EndIf
Next
IniWrite($GhostIni,'HardDisk','BackP',IniRead($GhostIni,'HardDisk','LoadP',''))
IniWrite($GhostIni,'HardDisk','BackZ',3)
FileWriteLine($GhostIni,'')
IniWrite($GhostIni,'Setting','Mode',3)
$DriveType=DriveGetType(StringLeft(@ScriptDir,2))
;If $DriveType='Fixed' Or $DriveType='ReMovAble' Then FIlecopy($GhostIni,@ScriptDir,1)
;================================================================================================
$GhostStrC=IniRead($GhostIni,'HardDisk','LoadP','')
$GhostStrL=IniRead($GhostIni,'HardDisk','LastP','')
$HomeDrive=IniRead($GhostIni,'HardDisk',$GhostStrC,'')
$LastDrive=IniRead($GhostIni,'HardDisk',$GhostStrL,'')
;FIlecopy($GhostIni,@ScriptDir,1)
Sleep(1000)
FileDelete($GhostIni)
FileDelete($Part)
FileDelete($Pan)
ToolTip('')
小弟写个系统备份工具 在获取硬盘分区信息时 在 132行处就弹出 图中的错误 (错误是用msgbox跟踪 跟到132行处就报错)