Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Passing arguments to scripts
Pages: [1] Print
Author Topic: Passing arguments to scripts  (Read 476 times)
Stoop
Newbie
*
Offline Offline

Posts: 10


View Profile
Passing arguments to scripts
« on: February 19, 2006, 10:32:51 AM »

Using one fo the examples to pass arguments to a script from the command line. So for example:

REBOL [
        Title:  "Command-Line Argument Example"
    ]

    print mold system/options/args
    print mold system/script/args

Called the file getarg.r.  However when I run it with arguments I get this:

>> do %getarg.r 54321 Launch!
Script: "Command-Line Argument Example" (none)
none
none
** Script Error: Launch! has no value
** Near: Launch!


What is the problem here?
Logged
Gabriele
Full Member
***
Offline Offline

Posts: 182


View Profile WWW
Passing arguments to scripts
« Reply #1 on: February 19, 2006, 05:50:51 PM »

Code:
do/args %getarg.r [54321 Launch!]
Logged
Stoop
Newbie
*
Offline Offline

Posts: 10


View Profile
Passing arguments to scripts
« Reply #2 on: February 20, 2006, 09:08:46 AM »

Thanks for that, that gets the argument in, but now I am having trouble doing a "find" with it.  This used to work, did arguments change in the newer versions of REBOL?

Anyway I am trying to get a name into the script and then do a find against the lines of a log file to track a user when he has problems.

So I can get the user name into the script with :

do/args %usertrk.r [John Smith]

And I assign that to a variable in my script as follows:

finduser: system/script/args


Now the line in my script that does work is if I code the name directly as follows:

if found? find line "John Smith"

I get a nice output file with all occurences of the user.

However if instead I subsitute this code:

if found? find line finduser

Then my output file is empty.

How do I need to modify the argument variable so it can be used as a string search?
« Last Edit: February 20, 2006, 08:08:43 PM by Stoop » Logged
Gabriele
Full Member
***
Offline Offline

Posts: 182


View Profile WWW
Passing arguments to scripts
« Reply #3 on: February 21, 2006, 01:00:33 PM »

If you need a  string, pass a string. Smiley

Code:
do/args %usertrk.r "John Smith"
Logged
Pages: [1] Print 
Rebol Talk Forum  |  Getting Started  |  Newbie Help  |  Topic: Passing arguments to scripts
Jump to:  

  
Quick Search...

Advanced search
  
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 03, 2008, 08:12:04 PM
Username: Password: Session Length:
  

News: 01-09-08

Alpha version of REBOL 3 has been released!


  
2315 Posts in 597 Topics by 4202 Members
Latest Member: Illispegelorp

  Rebol Talk Forum | Powered by SMF 1.0.9.
© 2001-2005, Lewis Media. All Rights Reserved.

RT design by Defiant Pc