forum.vdsworld.com Forum Index forum.vdsworld.com
Visit VDSWORLD.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Command arguments

 
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help
View previous topic :: View next topic  
Author Message
Jibet
Newbie


Joined: 17 Sep 2007
Posts: 2
Location: France

PostPosted: Mon Sep 17, 2007 11:12 pm    Post subject: Command arguments Reply with quote

Hello ! Very Happy
Sorry for my bad english ! Embarassed

Is somebody knox how I could have most than 9 parameters ! Question

Thanks !


JB
Back to top
View user's profile Send private message
Hooligan
VDS Developer
VDS Developer


Joined: 28 Oct 2003
Posts: 480
Location: California

PostPosted: Tue Sep 18, 2007 3:04 am    Post subject: Reply with quote

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
View user's profile Send private message
DaveR
Valued Contributor
Valued Contributor


Joined: 03 Sep 2005
Posts: 413
Location: Australia

PostPosted: Tue Sep 18, 2007 9:10 am    Post subject: Reply with quote

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
View user's profile Send private message
Jibet
Newbie


Joined: 17 Sep 2007
Posts: 2
Location: France

PostPosted: Tue Sep 18, 2007 11:27 am    Post subject: Command arguments Reply with quote

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. Very Happy



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
View user's profile Send private message
Skit3000
Admin Team


Joined: 11 May 2002
Posts: 2166
Location: The Netherlands

PostPosted: Sat Sep 22, 2007 6:32 pm    Post subject: Reply with quote

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. Smile

_________________
[ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forum.vdsworld.com Forum Index -> General Help All times are GMT
Page 1 of 1

 
Jump to:  
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

Twitter@vdsworld       RSS

Powered by phpBB © 2001, 2005 phpBB Group