Problem with passing arguments to script

35 views
Skip to first unread message

zetah

unread,
Jul 15, 2012, 3:49:14 PM7/15/12
to scite-i...@googlegroups.com
None of properties files that ship with Scite uses parameters on command run definition
If user wants to pass command line arguments to script, as per scite docs 4 parameters can be used and substituted with $(1) $(2) $(3) $(4) accordingly

So I make run command:

  exec "$(FilePath)" "$(1)" "$(2)" "$(3)" "$(4)"

In this case, if I don't define parameters 3 and 4 with parameters dialog, script will receive them as arguments also (thou empty: "" "") and if script depends on arguments to define actions it will fail.

This:

  exec "$(FilePath)" $(1) $(2) $(3) $(4)

doesn't work if parameter has space, as expected.

So what would be most sensible way of defining run command for arbitrary number of parameters?

steve donovan

unread,
Jul 16, 2012, 4:00:48 AM7/16/12
to scite-i...@googlegroups.com
On Sun, Jul 15, 2012 at 9:49 PM, zetah <klo...@gmail.com> wrote:
> exec "$(FilePath)" "$(1)" "$(2)" "$(3)" "$(4)"

Yep, I've hit this problem - went to the trouble of patching SciTE so
that it would automatically generate the arguments for programs.

In the meantime, the solution is to remember to put the quotes in when
setting the parameters ;)

I suppose one could treat 1 .. n as 'special' values and automatically
quote them if they contain spaces, etc.

steve d.
Reply all
Reply to author
Forward
0 new messages