Shopping Cart | My Account | eNewsletter | Friends with Vision | Language Selector Datacolor Logo
ProductsPurchaseLearningSupportContact UsCompany
Our Products

Datacolor ColorFacts Professional

Datacolor ColorFacts Macros

What is Integrated Visual Basic?

Visual Basic is a popular programming language that is used for many applications. ColorFacts has a built-in Visual Basic script engine that lets you extend the functionality to do specific tasks in your organization. For example, you can use the Visual Basic macros to write color test readings out to a file. Or, you can create an automated, closed loop calibration system that directly updates your display device with readings taken from your color measuring instrument.

 
Accessing Macros in ColorFacts

The Visual Basic Macro engine is accessed by clicking on the Edit/Macro menus. You will see the Manage Macros dialog, which shows you a list of all of your macros. You can edit, add, delete or run macros from this screen. Click on the thumbnail below to see the Manage Macros dialog, a code window, and sample dialog built from the macros.

 
Click to view the Macros and Code window
 
Script Language Features

  • Full Visual Basic for Applications(TM) compatible, including all code features, error handling, file handling and COM object support.
  • Integrated debugger with ability to step through the code and view variables.

Click to view integrated debugger.

  • Built-in color-coded Visual Basic editor with full 'intellisense' support that shows code syntax and object properties and methods while you edit the code.

Click to view intellisense code editor.

  • Integrated Dialog Editor lets you build data-entry screens as shown in the picture below.

Click to view Dialog Editor.

 
Built-in Features of ColorFacts Scripting

Communications
The low-level communications with your color measuring Instrument is built-in to ColorFacts. Your macro only needs to run a single line to get a reading, and then access the data.  If you were to write your own code, it would take many weeks of testing to send the correct commands to the device.

ColorFacts API
The ColorFacts API (Application Programming Interface) is a rich set of COM objects that hide the complexity and mathematics of color science. The script writer can concentrate on solving specific business without having to understand precisely how all of the different color spaces and measurements relate to each other.

Click to API Help.

ColorFacts API includes many powerful color algorithms and functions, which makes writing code very easy. For example, you can automatically convert readings to other colorspace systems such as CIELuv, CIELab, CIELCh, RGB, and XYZ.

With simple method calls, the API can return a matrix of data that can easily be written to other applications for further analysis.

Sample Code:
Here is some sample code to take a reading and write it to a file:
With oMeter
       Set oReading = .Reading
       Open "C:\MyFile.csv" For Append As #1
       Write #1, oReading.xyY.x , oReading.xyY.Y, oReading.xyY.Lum
       Close #1
End With

With just a single line of code " Set oReading = .Reading", the macro will communicate with your color measuring- instrument and take the reading. The oReading object will have all of the readings in easy-to-use properties. For example, to access the x value from the xyY reading, you simply use "oReading.xyY.x", as is shown in the code above.  In this example, the three values (xyY) are written to a CSV file, which can be opened by Excel. 

The are many dozens of properties and methods built into the API that simplify your programming tasks.

 
Extend The ColorFacts Menu
After your macro has been tested you can add it to the "Measure" menu in ColorFacts by simply saving it with a ".cfw" extension.  The picture below shows how it appears to the end-user:

Click to new macro in Measure Menu.

More Information

ColorFacts Reports
ColorFacts Macros
ColorFacts Screen Shots
Colorfacts Technical Articles

 
Reviews

Read all reviews »