You can automate tasks in Kanzi Studio by executing Kanzi Studio commands on the command line interface. For example, use this approach when you want to export kzb files of a large number of Kanzi Studio projects on a build server.
For the list of available commands see Kanzi Studio command reference .
To automate Kanzi Studio tasks:
LoadProject command followed by the path to the Kanzi Studio project you want to open, and save the script as MyScript.txt.LoadProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj"
/Script flag pointing to the script you created in the previous step.KanziStudio.exe /Script="C:\Users\username\Documents\MyScript.txt"
Use the ExportBinary command when you want to export a kzb file from a Kanzi Studio project.
To automate the exporting of kzb files:
# Open the project named MyProject. LoadProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj" # Export the kzb file to the location set in the > in the Binary Export Directory property. # To export the kzb file to another location use: ExportBinary "Path\to\directory\MyProjectBinary.kzb" ExportBinary # Close Kanzi Studio. If you want to continue using Kanzi Studio after the script executes, comment out this line. ExitApplication
The ExportBinary command takes these optional parameters:
For example, to export both the theme and locale resources to separate kzb files, and the xml version of the kzb file:
# Export the theme and locale resources and the xml version of the kzb file. ExportBinary true true
KanziStudio.exe /Script="C:\Users\username\Documents\MyScript.txt"
Use the ExportApk command when you want to build Kanzi applications for Android.
To automate the building of Kanzi applications for Android:
# Open the project named MyProject. LoadProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj" # Before you build the APK file, set whether to install the APK file to your Android device and launch the application. # In the Library > Applications > MyProject disable the Install to Device property. SetProperty "/Resource Files/Applications/MyProject" BuildConfigurationInstallToDevice false # In the Library > Applications > MyProject disable the Launch Application property. SetProperty "/Resource Files/Applications/MyProject" BuildConfigurationRunApplication false # Build the APK file using the Library > Applications > MyProject application configuration. # The second parameter sets whether Kanzi Studio compresses the images in the project. ExportApk "/Resource Files/Applications/MyProject" true # Close the project. CloseProject
KanziStudio.exe /Script="C:\Users\username\Documents\MyScript.txt"
Use the ImportEnginePlugin command when you want to:
To automate the importing of Kanzi Engine plugins:
# Open the project named MyProject. LoadProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj" # Import the Kanzi Engine plugin DLL from MyOtherProject\Application\lib\Win32\GL_vs2015_Debug_DLL. ImportEnginePlugin "C:\KanziWorkspace\Projects\MyOtherProject\Application\lib\Win32\GL_vs2015_Debug_DLL\XML_data_source.dll" # Save the project. # The second parameter sets whether Kanzi Studio continues working in the old path. SaveProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj" true # Close the project. CloseProject
KanziStudio.exe /Script="C:\Users\username\Documents\MyScript.txt"
When you receive from a developer or create a new version of a Kanzi Engine plugin to take the new version into use you need to update the Kanzi Engine plugin in your Kanzi Studio project.
To automate the updating of Kanzi Engine plugins:
# Open the project named MyProject. LoadProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj" # Update the Library > Kanzi Engine Plugins > XML_data_source plugin. # You leave the first parameter empty because you do not import a new plugin to the project. ImportEnginePlugin "" "/Kanzi Engine Plugins/XML_data_source" # Save the project. # The second parameter sets whether Kanzi Studio continues working in the old path. SaveProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj" true # Close the project. CloseProject
KanziStudio.exe /Script="C:\Users\username\Documents\MyScript.txt"
Use the SetProperty command when you want to set property values of nodes and resources in a Kanzi Studio project.
To automate the setting of property values:
# Open the project named MyProject. LoadProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj" # In the Screen node set the Metrics Type property to Absolute. SetProperty "/Screens/Screen" Window.MetricsType Absolute # In the Screen node set the Width property to 1200. SetProperty "/Screens/Screen" WindowAbsoluteWidth 1200 # In the Screen node set the Height property to 720. SetProperty "/Screens/Screen" WindowAbsoluteHeight 720 # Save the project. # The second parameter sets whether Kanzi Studio continues working in the old path. SaveProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj" true # Close the project. CloseProject

KanziStudio.exe /Script="C:\Users\username\Documents\MyScript.txt"
Use the PrintDiagnosticReport command when you want to log invalid project items.
To automate the logging of invalid project items:
# Open the project named MyProject.
LoadProject "C:\KanziWorkspace\Projects\MyProject\Tool_project\MyProject.kzproj"
# Print a list of invalid project items to the KanziStudio.log file.
PrintDiagnosticReport MyProject
# Close the project.
CloseProjectKanziStudio.exe /Script="C:\Users\username\Documents\MyScript.txt"
Kanzi Studio command reference