Creating Own Plugin Constants

3 messages Options
Embed this post
Permalink
Adam Dempsey

Creating Own Plugin Constants

Reply Threaded More More options
Print post
Permalink
Is it possible to somehow create my own plugin parameter constants that can be passed without being literal text in speech marks.

eg atm to pass parameters I have to use:

Plugin_Function("first-parameter", "second-parameter")

But it would be good if I could have a list of accepted parameters in my plugin which can be passed without being in speech marks, as True and False can for example.

So if in my plugin I register "first-parameter" and "second-parameter" as valid parameters, this would be valid:

Plugin_Function(first-parameter, second-parameter)

But this would give an error, similar to when you have an incorrect number of params etc:

Plugin_Function(first-parameter, invalid-parameter)

Is anything like this possible or do text parameters have to be passed  in speech marks?

Thanks

Adam

Jake Traynham

Re: Creating Own Plugin Constants

Reply Threaded More More options
Print post
Permalink
Hi Adam,

   A few of my plug-ins make use of "Constants" .. like our SMTPit
Plug-in has a "constant" named "SMTPit_Append" that evaluates to "True".
  But there's nothing special about it.  It's just a function like any
other plug-in function, it just doesn't take any parameters and returns
the same value all the time.

   As far as the name of your "constants", I would suggest making sure
they are unique.  You wouldn't want to register a function named
something like "FirstName" because someone might have a field named that
or something.  I use the same prefix on my constants that I do on my
normal plug-in functions (eg. "SMTPit_" or "POP3it_").

I hope this helps,
Jake

adam.dempsey wrote:

>  
>
> Is it possible to somehow create my own plugin parameter constants that
> can be passed without being literal text in speech marks.
>
> eg atm to pass parameters I have to use:
>
> Plugin_Function("first-parameter", "second-parameter")
>
> But it would be good if I could have a list of accepted parameters in my
> plugin which can be passed without being in speech marks, as True and
> False can for example.
>
> So if in my plugin I register "first-parameter" and "second-parameter"
> as valid parameters, this would be valid:
>
> Plugin_Function(first-parameter, second-parameter)
>
> But this would give an error, similar to when you have an incorrect
> number of params etc:
>
> Plugin_Function(first-parameter, invalid-parameter)
>
> Is anything like this possible or do text parameters have to be passed
> in speech marks?
>
> Thanks
>
> Adam
>
>

--
Jake Traynham
Owner, CNS Plug-ins
http://www.cnsplug-ins.com/
Adam Dempsey

Re: Creating Own Plugin Constants

Reply Threaded More More options
Print post
Permalink
Seems so simple now you say that!  And I would just make it so that these functions don't show up in the functions list!

Cheers for that Jake!

Adam


--- In [hidden email], Jake Traynham <jake@...> wrote:

>
> Hi Adam,
>
>    A few of my plug-ins make use of "Constants" .. like our SMTPit
> Plug-in has a "constant" named "SMTPit_Append" that evaluates to "True".
>   But there's nothing special about it.  It's just a function like any
> other plug-in function, it just doesn't take any parameters and returns
> the same value all the time.
>
>    As far as the name of your "constants", I would suggest making sure
> they are unique.  You wouldn't want to register a function named
> something like "FirstName" because someone might have a field named that
> or something.  I use the same prefix on my constants that I do on my
> normal plug-in functions (eg. "SMTPit_" or "POP3it_").
>
> I hope this helps,
> Jake
>
> adam.dempsey wrote:
> >  
> >
> > Is it possible to somehow create my own plugin parameter constants that
> > can be passed without being literal text in speech marks.
> >
> > eg atm to pass parameters I have to use:
> >
> > Plugin_Function("first-parameter", "second-parameter")
> >
> > But it would be good if I could have a list of accepted parameters in my
> > plugin which can be passed without being in speech marks, as True and
> > False can for example.
> >
> > So if in my plugin I register "first-parameter" and "second-parameter"
> > as valid parameters, this would be valid:
> >
> > Plugin_Function(first-parameter, second-parameter)
> >
> > But this would give an error, similar to when you have an incorrect
> > number of params etc:
> >
> > Plugin_Function(first-parameter, invalid-parameter)
> >
> > Is anything like this possible or do text parameters have to be passed
> > in speech marks?
> >
> > Thanks
> >
> > Adam
> >
> >
>
> --
> Jake Traynham
> Owner, CNS Plug-ins
> http://www.cnsplug-ins.com/
>