[Gambas-user] gb.args - Probably a dumb question but ...

Dimitris Anogiatis dosida at gmail.com
Fri Feb 14 01:59:48 CET 2020


Perhaps try:

*Public Sub Form_Open()*

*  'Dim $runtoday As Boolean = True*

*  Args.Begin()*
*  'If Args.Has("t", "today", "Run plots for today") Then $runtoday = True*
*  Print *Args.Has("t", "today", "Run plots for today")
*Args.End*

*  'Print $runtoday*

*End*

Compile and run and check whether you get the correct values for Args.Has

That way you'll see under what initial value you need to give to $runtoday
and whether you need to modify your if slightly to get the functionality
you need

Hope this helps


Regards,
Dimtiris


On Thu, Feb 13, 2020 at 9:44 AM Charlie Ogier <charlie at cogier.com> wrote:

> This code works for me.
>
> *Public Sub Form_Open()*
>
> *  Dim $runtoday As Boolean = True*
>
> *  Args.Begin()*
> *  If Args.Has("t", "today", "Run plots for today") Then $runtoday = True*
> *  Args.End*
>
> *  Print $runtoday*
>
> *End*
>
> The result is *True* even if there is no *-t*, tested with 'global' and
> local Boolean. This was done in the IDE.
>
> Charlie
>
> On 13/02/2020 09:10, Bruce wrote:
>
> If Args.Has("t", "today", "Run plots for today") Then $runtoday = True
>
> I have probably done something wrong here but if $runtoday has already
> been set True then that line, if there is no "-t" on the command line seems
> to set $runtoday false.
>
> (Unless I have done something stupid somewhere else?)
>
> Any clues? There doesn't seem to be a default value for "If Args.Has"
> mentioned in the help docs.
>
> tia
> b
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gambas-basic.org/pipermail/user/attachments/20200213/2641b0fa/attachment.html>


More information about the User mailing list