Creating a Custom Action for Desktop Projects
You can create a custom action to enable execution on desktop objects for which you need to program in Visual Basic. Also, you can create general web actions that do not require desktop objects.
Before creating a custom action, if you have a VB editor other than Notepad, then edit the VB Editor path in Project Settings.
For example, if you want to create custom action as "CustomSetValueInEditBox" for WebEdit, create a new vbs file with name CustomWebEdit. This action will set the specified value into the webedit so method will look similar to below.
The first arg is the webedit object as this action will directly perform the action on the edit boxobject. The second arg is of type string which is the value that needs to be set in the edit box. The custom action returns with an integer value.
If the action does not interact with any object then ObjectInfo parameter is not required.
You cannot modify a custom action code in the Visual Basic file, if the file is locked by another user.
To create a custom action for desktop projects:
- Open the desktop project where you want to create a custom action.
- From the Expand Menu, click Custom Actions.
- Click the Custom Actions tab.
- Do the following in the order listed.
- Enter the name of action, in Action Name.
- Enter the role of the custom action, in Description.
- From the Technology drop-down list, select the technology under which you want to create a custom action.
- From the Base Class drop-down list, select a base class.
- If you select a base class as General to create general actions, you get a pop-up to select Java or VB.
Do one of the following:- To do coding in VB , select VB, and continue performing the actions as mentioned here.
- To do coding in Java, select Java. The dialog box for creating general actions opens. For more information, refer to creating a custom action for web and mobile projects.
- From the VBS File drop-down list, do one of the following:
- Select an existing visual basic file.
- Select Create New File to create a new visual basic file. Enter the name of the new VB file you want to create without including its extension.
- From the Functions drop-down list, do one of the following:
Select an existing function.
You must ensure that you do not map a function created for a General Action to a Non General Action and vice versa. However, if you do so, you might see unexpected behaviour of your Custom Action.
- Select Create New Function to create a new function. Enter the name of new function.
Under Properties, do one of the following:
- If you have selected an existing function, the existing arguments are displayed. You need to select data type for existing parameters.
- If you have selected a new function, add new parameters along with their data types.
- Do one of the following;
Click Save to save the custom action in the selected VB script file.
Click Save and Launch Editor to save the custom action in the selected VB script file and then launch this file in the VB editor.
The custom action is added.
- Click Edit Code to write codes to develop the custom action.
You need to consider the custom action rules.
.