| View previous topic :: View next topic |
| Author |
Message |
Jibet Newbie

Joined: 17 Sep 2007 Posts: 2 Location: France
|
Posted: Mon Sep 17, 2007 11:12 pm Post subject: Command arguments |
|
|
Hello !
Sorry for my bad english !
Is somebody knox how I could have most than 9 parameters !
Thanks !
JB |
|
| Back to top |
|
 |
Hooligan VDS Developer


Joined: 28 Oct 2003 Posts: 480 Location: California
|
Posted: Tue Sep 18, 2007 3:04 am Post subject: |
|
|
Hi Jibet,
Welcome to the VDSWorld forums!
When I find that I need that many command line parameters, I usually try to create an ini file instead, or just query the user to answer questions. I'm curious as to why you need more than 9 parameters?
Hooligan _________________ Hooligan
Why be normal? |
|
| Back to top |
|
 |
DaveR Valued Contributor


Joined: 03 Sep 2005 Posts: 413 Location: Australia
|
Posted: Tue Sep 18, 2007 9:10 am Post subject: |
|
|
A ini file is the way to go. But if you really want to use more than 9 command line parameters you can use multiple parameters as one parameter by separating them with a field separator like | and then parse the parameter into the separate parameters.
The following example only uses one parameter but will be later parsed into 12 parameters:
| Code: | | my.exe par1|par2|par3|par4|par5|par6|par7|par8|par9|par10|par11|par12 |
_________________ cheers
Dave |
|
| Back to top |
|
 |
Jibet Newbie

Joined: 17 Sep 2007 Posts: 2 Location: France
|
Posted: Tue Sep 18, 2007 11:27 am Post subject: Command arguments |
|
|
I have make a lot of scripts for rename files with date or index, for comments files, etc...
I use that scripts with selectionned files in explorer with FileMenu Tools :
http://www.lopesoft.com/en/index.html
But i'm limited to 9 selection.
Thanks for you answer.
| Hooligan wrote: | Hi Jibet,
Welcome to the VDSWorld forums!
When I find that I need that many command line parameters, I usually try to create an ini file instead, or just query the user to answer questions. I'm curious as to why you need more than 9 parameters?
Hooligan |
|
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Sat Sep 22, 2007 6:32 pm Post subject: |
|
|
You can try this function:
| Code: | #define function,GetParam
%%Parameters = @GetParam()
list create,1
list assign,1,%%Parameters
# Return 10th parameter
info @item(1,12)
list close,1
exit
:GetParam
# commandline
%c = @cmdline()
# counter
%z = 1
# output
%o =
# buffer
%b =
while @greater(@len(%c),@pred(%z))
# On chr(32), new parameter
if @equal(@substr(%c,%z,%z),@chr(32))
# Save buffer to output
%o = %o@cr()%b
# Clear buffer
%b =
# On chr(34), skip all characters
elsif @equal(@substr(%c,%z,%z),@chr(34))
# Next character
%z = @succ(%z)
# Loop until next chr(34)
while @both(@unequal(@substr(%c,%z,%z),@chr(34)),@greater(@len(%c),@pred(%z)))
# Save character to buffer
%b = %b@substr(%c,%z,%z)
# Next character
%z = @succ(%z)
wend
# If the end of %c is NOT reached, remove last character (which will be chr(34) always)
if @greater(@len(%c),@pred(%z))
%b = %b@substr(%c,%z,%z)
%b = @strdel(%b,@len(%b))
end
# All other characters
else
# Safe character to buffer
%b = %b@substr(%c,%z,%z)
end
# Next character
%z = @succ(%z)
wend
# Add last buffer to output
%o = %o@cr()%b
# Return
exit %o |
It returns a string with on every new line a new parameter. If you assign this string to a list, you can use @item() of @next to loop through all parameters.  _________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|