Multiple parameters to an external plugin

2 messages Options
Embed this post
Permalink
duogravis

Multiple parameters to an external plugin

Reply Threaded More More options
Print post
Permalink
I'm a newbie to writing FMP Plugins & need to be able to pass several
fields to an external plugin which I'm writing.  This plugin will
return several fields back.   Eg: surname, medical aid number, date of
birth etc.    
How does one handle this scenario with plugins:  create a C-type
structure & use that?  Or must it be a single string in csv or
pipe-delimited format?
Many thanks!

kvtech

Re: Multiple parameters to an external plugin

Reply Threaded More More options
Print post
Permalink
This is how I did it -Ken.

/*
   String Split - Kvtech (filemaker plugin group) 11/20/2008
   freeware private or commercial    
   extracts comma delimited strings

   Note: modify main() so that you are passing an FHANDLE parm
 
   i'm sure there are better ways to do this
   however should work with any c/c++ compiler    
   Compile as a win console mode app to test
*/

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <conio.h>

main()
{
        int c,i,j,k,len,p;

        char str [80];  /* local holding place for original parm */

        char str1[80];      /* number of strings = number of parms*/
        char str2[80];
        char str3[80];


        sprintf(str,"%s","Parm1,Parm2,Parm3");
                                       /*  str = entire parm string*/
        len=strlen(str)+1;            /*  account for c's zero byte */

        for (i=0; i<len; i++) {            /* extract parm1 into
str1*/
        str1[i]=str[i];
                if ((str[i]==',') || (str[i]==0)) {
            str1[i]=0;
            break;
        }
        }


    j=i+1; k=0;                     /* adjust pointer for next parm*/
        for (i=j; i<len; i++) {
        str2[k]=str[i];                 /* extract parm2 into str2 */
        k++;
            if ((str[i]==',') || (str[i]==0)) {
            str2[k-1]=0;
            break;
        }
        }


    j=i+1; k=0;                      /* extract parm3 into str3 */
        for (i=j; i<len; i++) {
        str3[k]=str[i];
        k++;
                if ((str[i]==',') || (str[i]==0)) {
            str3[k-1]=0;
            break;
        }
        }
       

    printf("%s\n",str);           /* original complte Parm string */

    printf("%s\n",str1);          /* parm1 */
    printf("%s\n",str2);          /* parm2 */
    printf("%s\n",str3);          /* parm3 */


    // i = atoi(str3);          /* if a parm was a num - convert it*/
    // printf("%i\n",i);

    getch();
}