Mobile Data StudioObject Model › External Access

Mobile Data Studio can be "automated" remotely, from other applications that support Visual Basic for Applications scripting.

Unlike Data Scripting within Mobile Data Studio, which can run script code in response to events such as the reception of sessions, remote automation always initiates operations. It cannot observe events.

Adding to References

If the other application's scripting environment supports it, you may find it helpful to add Mobile Data Studio to its list of References. This will make information about Mobile Data Studio classes, properties and methods available for auto-completion and debugging. This step is not required.

For historical reasons, the name of Mobile Data Studio's class information for References is "PPCC".

Accessing the Application

The entry point for automating Mobile Data Studio from another application is always the root Application object. Thus the first step is to retrieve this object, which will attach to the running instance of Mobile Data Studio if available, or launch it if necessary.

If you have added "PPCC" to your References, you can use strong-typing as follows:

Dim application As PPCC.Application
Set application = CreateObject( "PPCC.Application" )

If you have not added a reference, you can use weak typing as follows:

Set application = CreateObject( "PPCC.Application" )

Accessing Projects

Once you have the root Application object, you can access all of its properties and methods to acquire other objects within the object model.

Most typical use-cases will need to access Project objects. There are properties and methods available in Application.Projects to enumerate open projects or open new projects, however the simplest case is you are working with a single known project is to:

Set project = application.Projects.Open( "C:\Path\To\Project.pcc" )

Accessing the Database

Once you have a Project object, its session database can be retrieved via its Project.Database property. This provides a Database object, which can be used to work with Session objects.

Set database = project.Database

Creating a Session

Given a Database object, a new, empty Session object can be created and some data assigned to it:

Set session = database.Add
session("SomePointName") = "value"

The session could then be saved to the database:

session.Save

Or perhaps, sent to a mobile device

session.SendToClient "SomeUnitID"