You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
1.2 KiB
Plaintext
65 lines
1.2 KiB
Plaintext
2 years ago
|
Option Explicit
|
||
|
Dim wshshell
|
||
|
Dim fso
|
||
|
Dim strDrive,Drive,Result,i,Found,strStart,strUsbIni
|
||
|
Dim Fnct
|
||
|
|
||
|
|
||
|
i = 0
|
||
|
On Error Resume Next
|
||
|
Do
|
||
|
err.Clear
|
||
|
i = i+1
|
||
|
Set wshshell = CreateObject("WScript.Shell")
|
||
|
Set fso = CreateObject("Scripting.FileSystemObject")
|
||
|
Set Fnct = CreateObject("Install.Functions")
|
||
|
WScript.Sleep 1000
|
||
|
Loop Until Err.Number = 0 OR i > 30
|
||
|
|
||
|
If Err.Number <> 0 Then
|
||
|
WScript.Quit
|
||
|
End If
|
||
|
|
||
|
|
||
|
|
||
|
Err.Clear
|
||
|
On Error Goto 0
|
||
|
|
||
|
|
||
|
Do
|
||
|
ScanAllDrives
|
||
|
WScript.Sleep 1000
|
||
|
Loop Until Result.IsReady
|
||
|
|
||
|
If wshshell.AppActivate ("Installation") THEN
|
||
|
wshshell.SendKeys ("%{F4}")
|
||
|
WScript.Sleep (1000)
|
||
|
End If
|
||
|
|
||
|
strUsbIni = Result.DriveLetter & ":\UsbStick.ini"
|
||
|
If fso.FileExists(strUsbIni) Then
|
||
|
strStart = Fnct.GetIniString("Autostart", "RestoreMachineData", strUsbIni)
|
||
|
Call wshshell.Run(strStart)
|
||
|
End If
|
||
|
|
||
|
Sub ScanAllDrives
|
||
|
Dim Drives
|
||
|
Set Drives = fso.Drives
|
||
|
For Each Drive in Drives
|
||
|
If Drive.DriveType = 4 Or Drive.DriveType = 1 Then Set Result = Drive
|
||
|
On Error Resume Next
|
||
|
If Drive.DriveType = 4 And Drive.IsReady Then
|
||
|
Set Result = Drive
|
||
|
Found = True
|
||
|
Exit Sub
|
||
|
End If
|
||
|
If Drive.DriveType = 1 And Drive.IsReady Then
|
||
|
Set Result = Drive
|
||
|
Found = True
|
||
|
Exit Sub
|
||
|
End If
|
||
|
Err.Clear
|
||
|
On Error Goto 0
|
||
|
i = i+1
|
||
|
Next
|
||
|
End Sub
|