version 2003
PA_GetTextParameter (params; index; text) long
| Parameter | Type | Description | |
| params | PA_PluginParameters | Parameters received in PluginMain | |
| index | short | Index of the parameter in params | |
| text | char * | Value (text buffer) of the index parameter (a TEXT) | |
| Function result | long | Text buffer size |
Description
The routine PA_GetTextParameter fills text with the value (of type text) of the index parameter in params and returns its size.
Depending on previous calls to PA_UseMacCharacters or PA_UseAnsiCharacters, text may contain Macintosh or ANSI characters.
To retrieve the size of the text, first call the routine setting text to 0L. Then allocate a buffer of the correct size and call the routine again.
See Create a new plugin for a description of parameter accessors.
NOTE:
The first parameter starts at index 1.
Example
Duplicate the text parameter.
void PluginMain( long selector, PA_PluginParameters params )
{
switch ( selector )
{
. . .kInitPlugin, kDeinitPlugin ...
case kMyRoutine : // declared as DoWithText(&T) in the STR# resource
{
char *text;
long textSize;
text = 0L;
textSize = PA_GetTextParameter(params, 1, 0L);
text = malloc(textSize);
textSize = PA_GetTextParameter(params, 1, text);
// Let's work with the text
DoSomethingWithThisText(text);
}
break;
}
}
See Also
About strings and characters, Create a new plugin.
Error Handling
PA_GetLastError keeps the last error that occurred before calling the routine.