![]()
Tag/API Config Add Function Example
In this example we will add a function that I often use to pad strings in wcCode. My ePad function is a little more enhanced than the pad function included with wcCode, hence the name ePad. Anyway, I want to add this function to my default Tag/API Config file (weTag.htc) so that I can easily edit the function parameters using the Tag/API Code Editor. The function declaration looks like this:
| declare function ePad LIB "MiscUtils" (epStr as string, epAmount as integer, epChar as string="
", epLeft as boolean=false) as string epStr is the input string This function returns the padded string. |
To add the ePad function to my Tag/API Config file, open the Tag/API Config Editor, by select Tag/API Config Editor from the tools menu. Note if you highlight the function declaration prior to opening the Tag/API Config Editor dialog, the function declaration will be display in a tool window above the Editor dialog. This way you can easily see what parameters you need to add. The screen below is what you should see if you have opened the MiscUtils.wch file and selected the ePad declaration, then selected Tag/API Config Editor from the tools menu:

Click the Add button to add a Tag/Api call and you should be displayed the following screen shot on the left. Enter the function name "ePad" as the Tag, then enter the function name again as the API Call Name. This tells the Tag/API Code Editor that the function is not a HTML tag, but an API call only. Note, all HTML tags must be enclosed in <>. Since this is not a HTML tag, do not check the "Has End Tag" checkbox; also do not add any parameters, the parameters here are only for HTML tags. The Edit Tag Parameters dialog should now look like the screen shot on the right.
![]() |
![]() |
Once you click OK the Tag/API Config Editor window should look like the following screen shot:

Now click the API Call Name Add button (lower Add Button) to add a parameter to ePad function. After clicking add you should have a dialog that looks like the following, with the first parameter entered.
![]() |
Note that the Parameter
Name is not the same as the function's actual parameter name of epStr. We use
InputString as the parameter name because it is more descriptive than epStr. The
parameter names do not have to match; what IS important is the order of the parameters.
You MUST enter the parameters in the order in which they are in the function
declaration. The epStr parameter is a string type so we select String as the parameter type. We select the Order to 1, because it is the first parameter in the function call. The epStr parameter does not have a default value, so we leave it set to none. |
After we enter all of the parameters the Tag/API Config Editor window looks like:

Note the parameter types for PadAmount and PadCharacter are set to non, meaning non-string type parameters. PdAmount is an integer type and PadLeft is a boolean type.
Also note I entered default values for the PadCharacter and PadLeft. PadCharacter is set to "/[s1]". PadLeft is set to false. If you look at the ePad declaration, you'll notice that these are the default values for these parameters.
Since we want one space character as our default for PadCharacter, we must use the space switch in the default value field, because actual spaces are not accepted. If I wanted my default value to be "Ryan Andersen" ( Ryan, 3 spaces, Andersen ), then my default value would be "Ryan/[s3]Andersen" or Ryan/[s3]Andersen.
Clicking OK saves the Loaded Tag/API Config file with the new changes. The loaded Tag/API Config file is displayed in the statusbar.
Now that we have add ePad to are Tag/API Config file of weTags.htc, we can now use the Tag/API Code Editor to edit this function. In the the code editor, hit F5 to invoke the Tag/API Code Editor, then select ePad from the Tag/API dropdown list. You can now easily edit ePad's parameters. Since I do a lot of DHTML coding my ePad function in the Tag/API Code Editor might look like the following:

The actual output of this function when the wcx is
run would be:
| Current Price: $24.95 |
end.