Recent

Author Topic: How access options in parameters ? Not default "has option" and ParamStr  (Read 5676 times)

seba22

  • Full Member
  • ***
  • Posts: 136
Welcome,

How could i access values like this one.
Code: [Select]
./project1 project1 --message="show new message" --body="sample body" somefile.jpg somefile2.jpg somefil3.jpg


I don't know is this possible to do but i have to ask.

Look at above start data.

When i use

ParamStr(x)
in foreach loop, i can acces

Code: [Select]
--message="show new message"
--body="sample body"
somefile.jpg
somefile2.jpg
somefil3.jpg

and that's not what i'm looking for.

I need acces to something like this.

Code: [Select]
if(--message) exist then showmessage(message.value)
if(--body) exist then showmessage(body.value)

for last data (after --xxx) count print
Code: [Select]
somefile.jpg
somefile2.jpg
somefil3.jpg


Is there any function ready build in ?

--message="test"

Or should i use "forach for all elements" and then manually extract   starting from  ="  ending to "   to get value of message  option parameter what is  actually test ?

 

Regards


marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.
Re: How access options in parameters ? Not default "has option" and ParamStr
« Reply #1 on: January 31, 2011, 02:12:36 pm »
Read the documentation of the getopts unit. (RTL package)


seba22

  • Full Member
  • ***
  • Posts: 136
Re: How access options in parameters ? Not default "has option" and ParamStr
« Reply #3 on: January 31, 2011, 08:39:47 pm »
Read the documentation of the getopts unit. (RTL package)

That's good.

Hard, but good :)


Regards

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12645
  • FPC developer.

 

TinyPortal © 2005-2018