# Getting Started

## External Application

By defining an external application, it is possible to open certain file types in an external application directly from Agile e6. The information for the external application is entered in the External Application screen ( Manager > External Applications).

In this list all valid external applications for a specific file type (here: doc) and a specific host (here: host_xy) are defined. The command/application which should be started for a specific file type is chosen by the best matching entry in the table. The best matching entries can be named in the following order

- 4 = most specific (matching type, matching hostname)
- 3 = (matching type)
- 2 = (matching hostname)
- 1 = (general entry valid for all applications in View mode)

| Node | Type | Mode | OS (Operating System) | Command
1 | - | - | V | intel-ms-nt5.1 | command1
2 | host_xy | - | V | intel-ms-nt5.1 | command2
3 | - | doc | V | intel-ms-nt5.1 | command3
4 | host_xy | doc | V | intel-ms-nt5.1 | command4

###

### Field Description

Field | Description | Example
Node | Name of client computer. "-" for any |
File Type | File type (file extension). "-" for any. | .html
Mode | The following modes are available: V= View E = Edit R=Redline P = Plot C = Convert U = Unwrap H = Help O = Office Suite |
OS | Operating system of client computer |
Command | Call external application, %s = file name It is possible to use (client) variable names (enclosed in brackets) in the command string. These are filled with their corresponding value before starting the application.
Node | Type | Mode | OS(Operating System) | Command
host_xy | zip | U | intel-ms-nt5.1 | unzip %s -d {TMP}
Synchron | Client waits till external program is closed |
Pre-Command-USX | Userexit command before application is started |
Post-Command-USX | Userexit command after application is closed |
Function | Only necessary when using File Replication, function for checking-out files | EAI_CHECKOUT
Comments | Additional information |

###
Example Defining and Starting Up a New Application

This example shows how to define and start up a new application. Here we define a new application for the file-type txt and the application mode view.

Node | Type | Mode | OS(Operating System) | Command
- | txt | V | intel-ms-nt5.1 | c:\WINDOWS\notepad.exe

There are two ways to start up this application with text files

Userexit xapp_exc

If the filename is known the application can be started by calling xapp_exc.

> xapp_exc("/FILE='C:\tmp\example.txt' /MODE=V");

or in 'client-waiting' mode

> xapp_exc("/FILE='C:\tmp\ example.txt' /MODE=V /WAIT");

If using a certain CAD versioning file system with file extension like base.prt.1 you have to specify the file type explicitly. If the filename is for example test.prt.42 the application can be started by calling xapp_exc with parameter TYPE :

> xapp_exc("/FILE='D:\tmp\test.prt.42' /MODE=V /TYPE='prt'")

Select menu on masks

Note: Prerequisite for this example is that the file "example.txt" must be assigned to a document.

There is already a selection for document masks which starts the external application. The Logiview model EP_APP/AppView allows the user to select a file (assigned to a document) which is started with the external application.

The following selection is defined in the standard:

Selection Name | Userexit | Parameter
EDB-BUT-VIE-DOC | lgv_sel_run | EP_APP/AppView

The Logiview procedure EP_APP/AppView contains as fix application mode "V"iew.

> 10 C -- Load document for Viewing, no specific file type
> 20 Init()
> 30 LoaDoc("V","")

To use the new application entry for Edit Mode, the easiest way is to define a new application and use EP_APP/AppView as a template:

EP_APP_CUSTOM/AppEdit

> 10 C -- Edit document, no specific file type
> 20 EP_APP/Init()
> 30 EP_APP/LoaDoc("E","")

Also a new selection must be defined e.g.

Selection Name | Userexit | Parameter
EDB-BUT-EDT-DOC | lgv_sel_run | EP_APP/AppEdit

The last remaining step is to assign the new selection to corresponding document masks (e.g EDB-DOC-DRW-SLS).

### Examples for Programming with external applications

This section presents a simple example for programming with external applications. The task is to start the Firefox browser in edit mode if the current Agile e6 user is contained in the filename otherwise Firefox is started simply in viewing mode.

Node | Type | Mode | OS(Operating System) | Command | Pre-Command-Usx
- | info | V | intel-ms-nt5.1 | C:\Program Files\Mozilla Firefox\firefox.exe | lgv_nosel_run(EP_DOC_VIEW/PRE_HTML)

EP_DOC_VIEW/PRE_HTML

> 10 EP_USER = user()
> 20 if (strchr(EP_APP_FILE, EP_USER) > 0)
> 30 EP_APP_CMD = strcat(EP_APP_CMD, " -edit ")
> 40 endif

If the current Agile e6 user is DEMOEP and wants to start up the application for the file Text_DEMOEP.info Firefox will start up:

> ... Mozilla Firefox\firefox.exe -edit /temp/Text_DEMOEP.info

If the current Agile e6 user is DEMOEP and wants to start up the application for the file Text_EDBCUSTO.info Firefox viewer will start up:

> ... Mozilla Firefox\firefox.exe /temp/Text_EDBCUSTO.info