Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

Access to script arguments

 [1/6] from: jrdrp:blueyonder at: 24-Nov-2001 1:31


Hi all, When I try to use/access script arguments they always seem to be set to none e.g. do %script1.r /args "testarg" In script1.r print system/script/args gives none John

 [2/6] from: tim:johnsons-web at: 23-Nov-2001 17:08


On Sat, Nov 24, 2001 at 01:31:07AM +0000, John R wrote:
> Hi all, > > When I try to use/access script arguments they always seem to be set to none > e.g. > > do %script1.r /args "testarg"
try do/args ..... at your rebol console: type the following
>> help do
tj
> In script1.r > print system/script/args
<<quoted lines omitted: 4>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Tim Johnson <[tim--johnsons-web--com]> http://www.johnsons-web.com

 [3/6] from: tim:johnsons-web at: 23-Nov-2001 18:39


On Sat, Nov 24, 2001 at 01:31:07AM +0000, John R wrote:
> Hi all, > > When I try to use/access script arguments they always seem to be set to none > e.g. > > do %script1.r /args "testarg"
Hi John: I should have been more clear in my last... ;here's a short example script: name is testargs.r REBOL[] print "args:" args: parse system/script/args none ?? args ;from the command line:
>> do %testargs.r "one two three"
Script: "Untitled" (none) args: ** Script Error: parse expected input argument of type: series ** Near: args: parse system/script/args none ?? ; now try
>> do/args %testargs.r "one two three"
Script: "Untitled" (none) args: args: ["one" "two" "three"] == ["one" "two" "three"] ; does that help? tj
> In script1.r > print system/script/args
<<quoted lines omitted: 4>>
> [rebol-request--rebol--com] with "unsubscribe" in the > subject, without the quotes.
-- Tim Johnson <[tim--johnsons-web--com]> http://www.johnsons-web.com

 [4/6] from: jrdrp::blueyonder::co::uk at: 24-Nov-2001 11:38


Hi Tim Thanks for pointer to me using wrong sysntax i.e. do %script.r /args "testarg" instead of do /args %script.r "testarg" It was very late last night and I guess I was thinking in unix terms - that's my excuse anyway! Thanks John

 [5/6] from: ammonjohnson:yah:oo at: 24-Nov-2001 11:13


better watch the space after 'do,
>> do /args %script.r "testarg"
== "testarg" this code DOes "/args" which results:
>> do /args
== /args it then evaluates each of the expressions:
>> %script.r
== %script.r
>> "testargs"
== "testargs" None of the expressions return an error so the commandline simply returns the last value. The correct code has no space between "do" & "/args"
>> do/args %script.r "testarg"
** Access Error: Cannot open /C/script.r ** Near: do/args %script.r "testarg" as you can see, %script.r doesn't exist in the current directory on my machine, but given a machine where it does exist you should be set! Enjoy!! Ammon

 [6/6] from: jrdrp:blueyonder at: 24-Nov-2001 23:25


Hi Ammon, Thanks - I eventually sussed out the error of my ways - no spaces! - I keep thinking in terms of the Rebol /xxx syntax as specifying parameters. I *will* remember in future! John

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted