Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.  

.

1. Create a Custom Action in VB Script

Create the custom action in VBScript by taking into consideration the custom action rules.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.

...

(info) If the action does not interact with any object then ObjectInfo parameter is not required.

Info

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:

  1. Open the desktop project where you want to create a custom action.
  2. Click Develop > Custom Actions.
  3. Click Create Custom Action.
  4. Do the following in the order listed.
     Click OK.
    1. Enter the name of action, in Action Name.
    2. Enter the role of the custom action, in  in Description.
    3. From the Technology drop-down list, select select the technology under which you want to create a  custom action.
    4. From the Base Class drop-down list, select a base class.Note:
    5. If you select a base class as WebGeneral General to create general web actions, you get a pop-up where you can select to code in Jave or VB. Upon selecting Java, it opens the 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
      web
      • general
      action
    6. From the VBS File drop-down list, select do one of the following:
      1. Select an existing visual basic file
      or select
      1. .
      2. Select Create New File to create a new visual basic file.

      If you select Create New File, enter
      1. Enter the name of the new VB file you want to
      create
      1. create without including its extension.
    7. From the Functions drop-down list, select an existing function or select do one of the following:
      1. Select an existing function.

        Info

        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.


      2. Select Create New Function to create a new function.

      If you select Create New Function, enter
      1. Enter the name of new function
      you want to create.

    Add the required parameters in the Properties section.

    Info

    (warning) Do not set the object parameter as given in the custom class. The user only needs to add the parameters in the same sequence as given in the vbs file excluding the Object Parameter. Then select the argument data type as String, Integer, or Array. Also, check if the parameter is Mandatory. Deselecting Mandatory option indicates that the parameter is not mandatory, that is zero length string data is allowed.

      1. .
  5. Under Properties, do one of the following:

    1. If you have selected an existing function, the existing arguments are displayed. You need to select data type for existing parameters.
    2. If you have selected a new function, add new parameters along with their data types.
  6.  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.
  7. Click Edit Code to write codes to do the coding required using the created custom actiondevelop the custom action.
    You need to consider the custom action rules.
    .