Home Image-Pro Automation (Macros, Apps, Reports)
Options

How to run a macro when Image-Pro Premier starts

There are 2 ways to do this, using the command line or simply by handling some project event.

How to specify a macro on Image-Pro Premier's command line
Using a command prompt, it is possible to specify a macro to run once Premier is started. The syntax is "Image-Pro-Premier" <Optional Project Path>?Call <Project Name>.<Macro Name>

The optional project path is useful to make sure that the project containing the macro is loaded and  it looks something like the following.

image

How to run a macro each time a project is loaded
Another approach is to use the project's Load event, which is a special macro that runs every time a project is loaded.
    Public Sub ThisProject_Loading() Handles ThisProject.Loading
        MsgBox "Project is loading"
    End Sub
How to run a macro the first time a project is loaded
Note however that this event is triggered each time the project loads, not only the first time. An additional test can be added to identify the very first load like in the following example.
    Public Sub ThisProject_Loading() Handles ThisProject.Loading
        If ThisApplication.MainForm.Tag Is Nothing Then
            MsgBox "Image-Pro Premier just started"
            ThisApplication.MainForm.Tag="Started"
        End If
    End Sub
Sign In or Register to comment.