[Gambas-user] Pass parameter to Gambas prog.

Dimitris Anogiatis dosida at ...626...
Mon Aug 17 11:13:11 CEST 2009


Hey charlesg,

you might want to experiment with the gb.option and the GetOptions class

here's an example to get you started

DIM opt AS NEW GetOptions("la:b:c:")

  IF opt["?"] = 1
    PRINT "error parsing the arguments"
  ENDIF

  IF opt["l"] = 1
    PRINT "found option l"
  ENDIF

  IF opt["a"] <> 1 AND opt["a"] <> 0
    PRINT opt["a"]
  ENDIF

  IF opt["b"] <> 1 AND opt["a"] <> 0
    PRINT opt["b"]
  ENDIF

  IF opt["c"] <> 1 AND opt["c"] <> 0
    PRINT opt["c"]
  ENDIF

Hope it helps

Regards
Dimitris

On Mon, Aug 17, 2009 at 2:59 AM, Steven James Drinnan <steven at ...2097...>wrote:

> short answer yes
>
> you retrieve it by using Application.Args[index]
>
> nb: Application.Args[0] is the program name
>
> Check in help for more details of how to use.
>
> Steven
>
>
> On Mon, 2009-08-17 at 00:34 -0700, charlesg wrote:
> > Hi all,
> >
> > Can I pass a parameter to a Gambas program?
> > e.g myprog.gambas parm1
> >
> > How do I read the parameter?
> > Any help gratefully received.
> >
> > rgds
>
>
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus
> on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now.  http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



More information about the User mailing list