[EMAIL PROTECTED] wrote:
> In article <02f401bf8a53$e4b74d40$7ac036d2@pavilion>, you wrote:
> >It may help to write a little test program, like this:
>
> Here is what I want to do:
> >From a DOS batch file that looks like this
> rebol -sqw trim.r %1 %2
As for .bat files, - they are synchronous while you don't attempt to run
windows app. I use following aproach:
money.bat content:
start /w rebol -qws money.r
another-win-app.exe
--------------------
This way you will achieve another-win-app.exe will not be run untill
Rebol session is finished. Just a tip for the case you would be
interested ...
btw: %1 and %2 are substituted with real filenames at the command line,
right?
> I want to run my script that trims the white space and
> detabs the input file. The input file would be %1 the
> output file will be %2.
>
> I did get the command line thing to work now, not sure how or
> why tho. Maybe some thing else was wrong in Windoze95 that
> day?
>
> Is there a simpler way to read/load/write from a file name
> that is in a variable that what I'm doing here?:
>
> ---------------
> REBOL [
> Title: "trim and detab file"
> Date: "Fri Mar 10 13:50:06 2000:"
> ]
>
> ; Manual says to use system/script/args
> ; [EMAIL PROTECTED] says to use system/options/args
> ; seems to work the same under Windoze95 either way:
>
> ;args: parse system/script/args none
> args: parse system/options/args none
> file_name_in: first args
> file_name_out: second args
>
> read_file: join "read ^(25)"file_name_in
> print read_file ; for debugging
>
uf, what's that? :-)
> write_file: rejoin ["write ^(25)"file_name_out" data"]
> print write_file ; for debugging
>
> data: do read_file
data: read to-file first args
; above one line should be enough.
; "first args" returns string containing file name
; "to-file" converts that string to file! datatype
; "read" just reads the file :-)
; "data" should contain what you wanted it to contain
; remember - with REBOL - simple things are often simple to do :-)
> detab data
> trim data
> do write_file
write to-file second args data
>
> ---------------
>
> It does what I want but only as long is every thing is the
> same directory.
>
yeah, the directory change stuff :-)
> I want to be able to run my trim.bat file from any place and
> have it located in N:\UTL\ which is in my DOS Path.
>
aha, now %1 and %2 makes more sense - you want to send params to .bat
file?
> If I put rebol.exe and trim.r in N:\UTL\, while I'm trying
> to run from N:\C\ and my batch file reads, which is also
> located in N:\UTL\:
>
> N:\UTL\rebol -sqw N:\UTL\trim.r %1 %2
>
> If I do "trim 00410/textfile.in 00410/textfile.out", while
> located in C:\N\ (00410 is below me, ie. N:\C\00410).
>
> I get "Access Error: cannot open /N/UTL/00410/textfile.in". Of
> course it can't because that file is not there. Whats with
> this behavior and how do I fix it?
>
hmm, you have two options. You can change directory inside your .bat
file, or not? Typical DOS stuff: CD mydir
or you can change directory in REBOL script:
change-dir mydir
If you want to see where is REBOL operating by default at the time when
your script is run, place what-dir in the beginning of your script. Of
course run your REBOL session without -w parameter to see the output :-)
Hope this helps,
-pekr-
> Printing out the strings read_file and write_file show me
> what I expect to see "read %00410/file.in" and
> "write %00410/file.out data".