Jump to content











Photo
- - - - -

PackParam, GetParam


  • Please log in to reply
1 reply to this topic

#1 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 16 June 2009 - 06:23 PM

Some members perhaps remember WB 076: Some new commands are described, before they are available in a released .exe (Just kidding for @wyefye: Lack of documentation?)

Here are two new commands, also 'Too Early'. The intention came by some difficulties Pedrole15 had in his API script.

Since the new variables handling I introduced in WB 076, the number of parameters passed to a 'Run' command is theoretically unlimited.
(Please, do not post a BugTracker report, that you have problems with 2 millon parameters! ...)

But if you pass more than 9 parameters, the 'Run' called section currently has some real problems to get e.g. parameter #11

The reason is historic and cannot be changed easily.

Currently a parameter is defined by '#?', where ? is a digit between 1 and 9.

A '#11' is not possible because the parameter can be anywhere, also in the middle of a string.

What does '1234#12345' result in?
Is parameter #1 inserted? Or parameter #12? Or ...

To be compatible with existing scripts, I did not see a reasonable solution.

Therefore I created two new commands:

GetParam,Index,%Var% writes parameter #index into %var%
PackParam,Start,%Var% packs all parameters from <start> into %var%, each enclosed in quotes, and separated by comma, like:
"param4","param5",...
PackParam optionally has an additional argument.
PackParam,Start,%Var%,%Num%. It writes the number of arguments into %Num%.
%Num% is always the number of ALL arguments, independent from Start

EDIT: I think that the GetParameter can be a solution 'forever'. Usually the number of parameters is below 10 and the param can be catched with the established '#'. If -in some rare cases- there are more than 9 parameters, the new command can be used.

BTW:

The quotes are currently still needed to be compatible with 'old' commands.
E.g. Pedro compares the 'RegRead' with something to write. The 'RegRead' delivers the quotes.
I'm really not happy with this situation and in my ToDo list there is a 'change'

Peter

#2 paraglider

paraglider

    Gold Member

  • .script developer
  • 1743 posts
  • Location:NC,USA
  •  
    United States

Posted 16 June 2009 - 11:40 PM

Could also use %<n>% where <n> is the parameter number as an insertion string. Can't be that many existing scripts where that would cause a problem as numeric environment or script variables are probably rare.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users