Manually customize a VBScript |
Create a VBScript file using the defaults. See VBScript Generation Options
In the Macrium Reflect main window, click the
VBScript files tab.
A list of VBScript source files appears.
Select a source file.
The VBScript contents appear in the lower half of the window with syntax
highlighting to help you read the code.
Right-click the VBScript file and select Edit
from the shortcut menu.
This opens the source file in your default text editor, the Windows
default is Notepad.exe. Make sure that Word Wrap is turned off.
Locate a line of code similar to:
ExitCode = Backup ("""C:\Program Files\Macrium\Reflect\reflect.exe""
-e -w <BACKUP_TYPE>
""C:\Users\Annette\Reflect\C
Full Image.xml""")
And replace it with your code. For example:
If Weekday(Date) = 2 AND Month(DateAdd("d", -7, Date)) <>
Month(Date) Then
' Run
the full image
ExitCode
= Backup ("""C:\Program Files\Macrium\Reflect\reflect.exe""
-e -w ""C:\Users\Annette\Reflect\C Full Image.xml""")
Else
' Run
the Incremental image
ExitCode
= Backup ("""C:\Program Files\Macrium\Reflect\reflect.exe""
-e -w ""C:\Users\Annette\Reflect\C Incremental Image.xml""")
End If
Where:
- Date is the current system date.
- The Weekday function returns the day of the week as a number. That
is, 1 = Sunday, 2 = Monday and so on.
- The DateAdd method is used to subtract 7 days from the current date.
Where, "d" represents days. Other possibilities include, "yyyy"
for Year, "q" for Quarter, "m" for Month, "y"
for Day of year, "w" for Weekday, "ww" for Week of
year, "h" for Hour, "n" for Minute, "s"
for Second.
- Month returns the month (1-12) of the DateAdd result and compares
this with the current month using the not equal to '<>' operator.
- The logic tests to see if the current day is Monday and the Monday
of last week is a different month, if it is, then this is the first Monday
of the current month. The code then executes the XML backup definition
file for the full image otherwise, the incremental XML definition is executed.
When you have made the changes, save the file and close Notepad.
Schedule the VBScript file to run every weekday. Execute or schedule the VBScript source file in exactly the same way as a backup definition file . See Schedule backups.
To learn more about VBScript we suggest that you experiment with the options in the generator. It generates separate functions for each option and provides code comments to help you understand them. You can also find reference information for all the VBScript functions on the external website, http://www.w3schools.com/VBscript/vbscript_ref_functions.asp.