Salesforce

How Do I Add External Tools to the Studio? (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

How Do I Add External Tools to the Studio? (Magic xpa 4.x)

Magic xpa includes a very powerful feature called the Tools Infrastructure.

Using the Tools Infrastructure, you can make your own customized tool menu for your application, using external tools, or tools built in Magic xpa. In fact, some of the Wizards that are used in Magic xpa are created using Magic xpa.

The tools are added to the Studio in the Magic.ini file, in the [TOOLS_MENU] section. In our example, we used:

[TOOLS_MENU]

Menu1 = A,&DDF Maker,,Add_On\DDFMaker\DDFMaker.ecf,,,Add_On\DDFMaker\DDF+

Maker_suf.opr,ImageFor = B ToolNumber = 60 ToolGroup 1

Menu2 = A,&Reports,,Add_On\ReportGenerator\ReportGenerator.ecf,,,+

,ImageFor = B ToolNumber = 23 ToolGroup 1

Menu3 = S,,,,,,,

Menu4 = O, &View INI,,notepad.exe %WorkingDir%magic.ini,,,,

There are 4 different types of items that can be put on the menu:

  • An Application, which calls a Magic xpa .ecf file.

  • An OS command, which executes any operating system command (batch file, executable, etc.)

  • A Submenu, which is a header for more entries beneath

  • A Line separator

The latter three are fairly self-explanatory. However, the first type, calling an .ecf file, is where you can develop (or use) very powerful tools. When an .ecf file is opened, there can be pre- and post- scripts which allow you to do macro-type processing.

The syntax varies slightly between the menu types, since not all entries are required for each.

Menu Entry

Syntax

Application

(formatted for readability)

<menu name> = A,

<caption>,

<parent menu>,

<ECF path>,

<access key>,

<pre-operation command file>,

<post-operation command file>,

<icons>

OS Command

<menu name> = O,<caption>,<parent menu>,<command>, <access key>,,,<icons>

Submenu

<menu name> = M,<caption>,<parent menu>,,,,,

Line separator

<menu name> = S,,<parent menu>,,,,,

Below is a summary of the menu items. These are explained more fully in the Magic xpa Help.

Menu Parameter

menu name

Name of this menu entry

This is the name that is used for the Submenu entries. It doesn’t show up on the menu

menu type

A = Application

O = OS Command

M = Submenu

S = Separator

caption

Name that will show up on the menu

This is what shows up on the menu. Can include & for an accelerator key.

parent menu

The name of the parent menu

This is blank for top-level menus.

Parent menu should be of type M.

ECF path\command

ECF: Points to a Magic xpa cabinet file.

OS Command: any valid operating system command

This points to an .ecf file or contains an operating system command, depending on the menu type.

access key

Accelerator key combination, such as Ctrl+1

pre-operation command file

Script file of commands to be executed before the ECF or OS command

The command files have their own powerful set of commands. These are explained in the Magic xpa Help file.

post-operation command file

Script file of commands to be executed after the ECF or OS command

The command files have their own powerful set of commands. These are explained in the Magic xpa Help file.

Icons

ImageFor = B ToolNumber = 60 ToolGroup 1

Icons to be used on the menu. The syntax here is the same as that used on the Menu entries in Magic xpa.

Adding an external tool

OK, so let’s look at how to add one external tool to the current menu.

Let’s add a call to the registry editor.

  1. Close your current application.

  2. Open the Magic.ini file you are using in an editor.

  3. Go to the [TOOLS_MENU] section.

  4. Add the OS call to Regedit according to the syntax described above:

[TOOLS_MENU]

Menu1 = A,&DDF Maker,,Add_On\DDFMaker\DDFMaker.ecf,,,Add_On\DDFMaker\DDF+

Maker_suf.opr,ImageFor = B ToolNumber = 60 ToolGroup 1

Menu2 = A,&Reports,,Add_On\ReportGenerator\ReportGenerator.ecf,,,+

,ImageFor = B ToolNumber = 23 ToolGroup 1

Menu3 = S,,,,,,,

Menu4 = O, &View INI,,notepad.exe %WorkingDir%magic.ini,,,,

Menu5 = O, Edit Registry,,regedit.exe,F12,,,

In our example, we made the F12 the accelerator key.

  1. Save the Magic.ini file, and restart the Studio. Now you will see your new menu entry. Selecting this item will bring start Regedit.

Reference
Attachment 
Attachment