Tutorial Step 8: Using ActiveX Automation

You can access nearly any function of ABE Project by using the automation object with ProgID "ABP.Project". To view complete list of methods and properties of Project object see ActiveX Automation support topic.

There are samples of using "ABP.Project" object from within MS Visual Basic below. If you wish to control this object from within another ActiveX container, these samples will show you general methods of interaction with ABE only. To learn more about using ActiveX Automation objects please consult your Programming Tool guide.

Creating and Loading an ABE Project

'Create an ABP.Project object

Set abp_project = CreateObject("ABP.Project")

'Set FileName property to needed file name

abp_project.FileName = "c:\work\example.svg"

'Load existing project; use Init() method to create an empty project

res = abp_project.Load()

If (res = False) Then HandleError ("ABE Project load error")

Adding/ replacing/ removing masks

'Include txt-files in c:\work folder with subfolders to the project

res = abp_project.AddMask("*.txt", "c:\work", True)

'get project's mask count

cnt = abp_project.MaskCount

'remove the last mask (the first mask index is 0)

no = cnt - 1

res = abp_project.RemoveMask(no)

'let user to configure the first mask

res = abp_project.ConfigureMask(0)

Saving an ABP Project

res = abp_project.Save()

If (res = False) Then HandleError ("ABE Project save error")

Creating a new backup

res = abp_project.CreateBackup()

If (res = False) Then HandleError ("ABE Project create backup error")

Restoring an existing backup

'set c:\temp folder as restore destination

abp_project.TargetFolder= "c:\temp"

'get the last backup name

cnt= abp_project.BackupVersionCount

zip_name= abp_project.GetBackupVersion(cnt-1)

'restore the last backup

res= abp_project.RestoreBackup(zip_name);

'if not all backed up files should be restored:

res= abp_project.RestoreBackupEx(zip_name, "file_to_restore.txt|and_this_one.*",

"do_not_resotre_this_folder\*.*");

Note: The error handling in the samples above was simplified.