22.3 Package Manager

The Package Manager is Origin's new replacement for OPK files. The old OPK files are binary files and were limited when it came to being used for module installation. The new OPX files are XML and have been designed with the goal of making module installation simpler for the user. You access the Package Manager dialog from the Tools menu.

Dialog: File Menu

The Package Manager dialog has a single File menu. This menu contains the following items:

New

Create a new package. This will cause the current package, if one is open, to be closed. If the current package has been changed but not saved then you will be prompted to save or discard the changes or cancel the creation of a new package.

Open...

Open an existing package file. This will cause the current package, if one is open, to be closed. If the current package has been changed but not saved then you will be prompted to save or discard the changes or cancel the creation of a new package.

Save

Save the current package to disk using it's current file name. If the package is new and does not yet have a file name then you will be prompted for a file name.

Save As...

Save the current package using a new file name.

Install a Package

You will be prompted with a file dialog to choose a package file. After choosing a package file and clicking Open the package will be installed.

Uninstall a Package

This item will show you the "Installed Packages" dialog. This dialog lists all the packages currently installed. Simply select the packages you want to uninstall and click the Uninstall button.

Extract a Package

Extracting a package is different than installing a package. Extracting a package is used when you only want to get the files out of the package. The before and after scripts will not be executed. You also will be prompted to choose the target folder which can be any folder you choose. The target folder does not have to be Origin's user nor system folder.

Close

Close the dialog. If changes were made to current package and have not been saved you will be prompted.

Dialog: Tree View

The tree view is where the package settings are edited. The following describes the settings.

Package
  • Module Name
    The name of the module. The name should remain the same for each *version released.
    During installation the Module Name is compared to the names of the packages already installed. If a match is found then the Version fields are compared and the user is notified that an older, newer, or same version of the package is already installed. The user is given the option to continue or cancel the installation.
  • Description
    A description of the module or package contents.
  • Version
    The version of the module contained in the package.
    During installation the Module Name is compared to the names of the packages already installed. If a match is found then the Version fields are compared and the user is notified that an older, newer, or same version of the package is already installed.
  • Author
    Who created the module contained in the package.
Apps
  • Icon
    The bmp image to used as App icon in Apps Gallery.
  • Launch Script
    The LabTalk script to be run when launching the App.
Origin Version Required

The version of Origin required to use the module contained in the package.

Target Path

The Target Path is used during installation and tells Package Manager where to install the contents of the package.

  • User = The User Files folder.
  • System = The Origin program folder.
  • Auto = Check the User and System paths for write access. If only one has write access then install there. If both have write access then prompt user to choose the target path.
Toolbar
  • Button Group File
    If the package contains a button group file and you want the button group to be added to Origin's User Defined button groups during package installation then specify the button group file here.
    The simplest way to set this field is to first add the button group file to the package. Once added you can select it in the list of files and then click the "Set Toolbar" button.
  • Create Toolbar
    This determines if a toolbar will be created, from the button group, during package installation.
    Check the box to create a toolbar or uncheck the box to not create a toolbar.
LabTalk Script
  • Before Installation
    The LabTalk code entered here is executed before the package is installed. If a LabTalk command error occurs then the installation will be canceled. If your script code does some checking and determines that installation should not continue then you can force a command error with 'break 1;' or set OPXERR to a non-zero value.
  • After Installation
    The LabTalk code entered here is executed after the package is installed.
  • Before UnInstalling
    The LabTalk code entered here is executed before the files that were installed are uninstalled/removed. Use this to undo any changes you may have done in the Before Installation or After Installation scripts. If your script code does some checking and determines that the uninstallation should not continue then you can force a command error with 'break 1;' or set OPXERR to a non-zero value.
Source Path

This field shows the source path for all the packed files. All files added to the package must come from the same source path. The Source Path is set when you add your first folder or file.

  • If your first folder or file comes from the Origin program folder or one of it's sub-folders then the Source Path is set to the Origin program path.
  • If your first folder or file comes from the User Files folder or one of it's sub-folders the the Source Path is set to the User Files folder.
  • If your first folder or file does not come from the Origin program folder nor the User Files folder then the Source Path is set to the path of the folder above the folder be added or to the path of the folder containing the file being added.
If the location of the files change then you can manually edit the Source Path. Once you change the Source Path setting to the new location you can use the Repack Files button when you want to update any changed files in the package. Being able to change the Source Path allows you to also repack packages that were made on other computers.

Dialog: Buttons

Below the tree view are six buttons. The following describes the buttons.

Repack Files

Click this button to repack all the files that have been added to the package. This button is useful when you change a file and want to put the file changes into the package. Instead of removing the file and adding it again you can simply click this button and all the new changes to your files will be repacked into the package.

This button is disabled until the package contains at least one file.

Set Toolbar

Click this button to set the Button Group File setting in the Toolbar branch of the tree view.

This button is disabled until you select a single file in the File List.

Add Folder...

Click this button to add a folder and all the files and subfolders contained in the chosen folder.

The Source Path field, in the tree view, will be set when adding the first folder or file to the package. For more information see Source Path.

Add Files...

Click this button to add files to the package. You will be prompted with a "Add Files To Package" file dialog.

The Source Path field, in the tree view, will be set when adding the first folder or file to the package. For more information see Source Path.

Remove Files

Click this button to remove all the selected files from the package.

This buttion is disabled until you select one or more files in the File List.

The right-most button is used to show and hide the File List.

Dialog: File List

The file list shows all the files that are currently in the package. The number of files in the list and the number of selected files will change the state of the buttons as described above.

OriginC

The Package Manager dialog is handled by OriginC code in OriginC\OriginLab\XMLPackage.c

The XMLPackage.c file calls a collection of Origin exported functions for working with packages. The following functions are declared in oUtils.h and exported from Origin's okUtil80.dll:

  • okutil_create_package_tree
  • okutil_create_package_file
  • okutil_install_package_file
  • okutil_uninstall_package_file
  • okutil_get_installed_package_names
  • okutil_add_folder_to_package
  • okutil_add_files_to_package
  • okutil_remove_files_from_package
  • okutil_get_packed_file_names
  • okutil_repack_files

See OriginC's oUtils.h for the function's return type and the argument accepted by each function.

Internal Behavior

When installing a package Origin will first check to see if the package has already been installed. If it has already been installed then Origin will inform the user that the package is already installed and ask if the installing should continue. If the user chooses to continue the installation then Origin will first uninstall the previous installation and then continue to install the current package.

For each package that gets installed Origin will copy the package, without the packed files, to a package list file. The package list file is OPXList.xml and is stored in the User Files folder.

Silent Install

To make an OPX that can be silently installed you need to have the following settings:

  • Set the LabTalk Script > Before Installation setting to blank or any script that does not provoke a user prompt.
  • Set the LabTalk Script > After Installation setting to any script that does not provoke a user prompt followed by the following two additional commands:
doc -s; 
exit;

After making the necessary changes to the OPX it is now possible to launch Origin, install the OPX, and exit Origin without any human interaction. The following command line demonstrates how to perform the silent install of the OPX.

Origin8.exe -h -R "instOPX OPXFileName.opx"

The above command line will need to be edited to use the file name of your OPX.