Code: Select all
VBSTART
Option Explicit
Function GetDrives
' Drive type constants
Const Unknown = 0
Const Removable = 1 ' Removable medium
Const Fixed = 2 ' Fixed medium (hard disk)
Const Remote = 3 ' Network drive
Const CDROM = 4 ' CD-ROM
Const RAMDisk = 5 ' RAM disk
Dim Title, DRIVE
Dim fso, oDrive, curDrive ' Object variables
Dim drtype(6)
drtype(0) = " Unknown "
drtype(1) = " Removable "
drtype(2) = " Fixed "
drtype(3) = " Remote "
drtype(4) = " CDROM "
drtype(5) = " RAMDisk "
' Create FileSystemObject object to access the file system.
Set fso = CreateObject("Scripting.FileSystemObject")
Set oDrive = fso.Drives ' Get Drives collection.
For Each curDrive In oDrive ' All drive objects
Select Case curDrive.DriveType ' Identify drive type.
Case Removable ' Removable medium
' If curDrive.IsReady Then 'It is never a removable drive
' End If
Case CDROM ' CD-ROM
' If curDrive.IsReady Then 'It is never a CD-ROM
' End If
Case Remote 'It is never a remote drive
Case Else ' Other medium
If curDrive.VolumeName = "Lacie Extern" THEN
DRIVE = curDrive.DriveLetter 'The drive letter of the Lacie is returned
End if
End Select
Next
GetDrives = DRIVE
End Function
VBEND
VBEval>GetDrives,drive_info
Dialog>Dialog1
Caption=Dialog1
Width=309
Height=125
Top=248
Left=180
Label=Windows na afloop afsluiten? (Ja / Nee / Annuleren),16,8,true 'Shutdown windows afterwards (yes, no, cancel)
Button=Ja,16,40,75,25,4 'Yes, returns 4
Button=Nee,104,40,75,25,5 'No, returns 5
Button=Annuleren,192,40,75,25,6 'Cancel, returns 6
EndDialog>Dialog1
Show>Dialog1
Label>ActionLoop
GetDialogAction>Dialog1,r
if>r=4,Backup
if>r=5,Backup
if>r=6,Exit
if>r=2,Exit
Goto>ActionLoop
CloseDialog>Dialog1
SRT>Backup
IfFileExists>%drive_info%:\backup\backup.zip,RunVoegToe,RunNieuw 'When backup exists RunIncremental, otherwise create new
END>Backup
SRT>RunNieuw 'Create New
RUN>E:\progs\winzip\wzzip.exe -a+ -P -r -ex -xd:\itunes*\*.* %drive_info%:\backup\backup.zip d:\*.*
WaitWindowOpen>E:\progs*
WaitReady>0
If>r=4,LogOff,Exit 'When button YES was clicked, goto LogOff. Otherwise Exit
END>RunNieuw
Label>RunVoegToe 'RunIncremental backup
GetDate>Date
RUN>E:\progs\winzip\wzzip.exe -P -r -i -ex %drive_info%:\backup\backup%Date%.zip d:\*.*
WaitWindowOpen>E:\progs*
WaitReady>0
If>r=4,LogOff,Exit
END>RunVoegToe
SRT>LogOff 'Shutdown system
RUN>C:\WINDOWS\system32\shutdown.exe -s -t 0
END>LogOff
Label>Exit