Carlos Roque Code Hints, Examples and more

11Aug/110

KPL Variables

KPL variables resemble PHP variables in the sense that they are loosely typed and don't have to be declared. For those new to programming, this means that you don't have to declare that the variable is an integer or a text string.

Naming

Variable names must start with an alphabetic character followed by any alpha-numeric combination, underscores are allowed but any other non alpha-numeric character is forbidden. These are some Examples of correct variable names:

  • myVar
  • MyVar
  • myVar123
  • myVar_123
22Jul/110

cmds files in DP2 – creating a simple order

If you want to get your feet wet with KPL, cmds files are the easiest way to get started. Cmds stands for commands, there are many uses for these files but the most important in my opinion is the import of photo orders from other applications. To be able to use cmds files we first  we need to enable a hot folder in DP2, the steps are as follows:

  1. On the User Tasks Menu Click on categories under you see the menu option Import
  2. Click Import and look for Commands
  3. Click Commands
  4. A new window opens, select a directory (preferably one that is easy accessible for your application)
  5. click Start
22Jul/116

What is KPL and how it relates to DP2?

KPL (Kodak Professional Language) is the underlying language that drives the DP2 Photo Lab production software. It is based on the C programming language family and it allows developers access to a lot of C methods and windows API's. The language has been greatly expanded from it's C roots to include features that are tailored to the photo production world.

The best way to understand this is to imagine DP2 as being a Runtime Environment in which KPL is Executed. The entire DP2 User interface and Underpinnings are implemented using KPL. Since KPL is an interpreted language, changes to DP2 do not require recompiling and can be done pretty much live.  Even thought documentation is limited, the fact that you can see all the code that is used to do everything in DP2, makes it easy to learn what does what. DP2 has a very powerful Programmer's Assistant tool and Debugger. There is also integration with Notepad++ for syntax highlighting also integration with the plugging snippets plus adds snippets and auto completion.

DP2 is a database driven application so naturally KPL has amazing tools for reading and writing data to the database. For what I have seen KPL is an Object Oriented Language, there is a long list of classes but most of the scripting that a user will be doing is based on the use of functions.

There is a great number of built-in functions for managing orders, images, packages and other production related work. Also, since Version 14 there is a very powerful Hooks system to alter the interface without having to change core DP2 files, this is a great way to avoid having your code being wiped out when a new version is installed.

There is a lot more to be said about KPL and DP2, you can create UIs using Html, JS and CSS, there is a built in Web server for receiving commands and there is also way to insert KPL scripts from other applications through the use of a hotfolder. There is robust printer integration, great queue management and print job organization. I will be talking more about this things on future articles as I work and discover more on the matter.

It is also important to note that the programming team at Kodak is filled with great, helpful people that will answer most of your questions almost immediately over email. And most of the changes in DP2 are driven by customer feedback.