[REBOL] Running from batch file? Re:(2)

2000-02-15 Thread bpaddock


 How do you start rebol  program from batch file?
start /w rebol -sq kurzy-seznam.r

Using the 'start' made it do what I expected it to do.

Nothing else did; I tried all of the suggestions that others
had made here.  Rebol is in my path, I have its home environment
variable set to it.  Both my home machine and my machine at
work acted the same way.

Didn't matter if I was in the C:\Rebol directory or out side
of it when I moved/ran my batch file.

With solution in hand its on to the next problem, even tho I
still don't understand the cause of this one.

The wonder of windoze,  I wonder why it did that



[REBOL] Running from batch file? Re:(3)

2000-02-15 Thread brian . hawley

At 09:02 PM 2/14/00 -0500, you wrote:
I've tried these variations, while being in the same
directory as rebol.exe:

rebol dns.r
rebol %dns.r
"rebol.exe" %dns.r
"rebol.exe" dns.r"

while being in a different directory:

"C:\REBOL\Rebol.exe" %dsn.r
"C:\REBOL\Rebol.exe" dsn.r

they all just go to the "" prompt.

REBOL starts in the REBOL home directory, not the current
directory. If your script is in a different directory, you
have to specify the whole path to the script on the command
line to REBOL.

If you want to get around this, use my #!REBOL.BAT method.
It was updated yesterday, so a copy is attached to this
message. It allows you to make REBOL batch files and put
them anywhere you can find them on the %PATH%. You will
have to edit the call to REBOL at the beginning to reflect
the actual place you put the #!REBOL.BAT file.

BTW, is the "%" required on the command line?  Seems to work
with or with-out it.

You don't need it. If you do use it, you must specify the
file using REBOL file syntax, %/C/AUTOEXEC.BAT rather than
C:\AUTOEXEC.BAT, for instance.

Enjoy!
Brian Hawley


@ECHO OFF
shift
rem *** The folowing call must be on ONE line ***
C:\Lang\Rebol\REBOL.exe --do "application-dirs: parse/all {%PATH%} {;}" --script 
C:\Utilities\bin\#!REBOL.BAT %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end-of-REBOL-launcher

REBOL [
Title: "#!REBOL Script Launcher"
Date: 14-Feb-2000
File: %#!REBOL.BAT
Author: "Brian Hawley"
Email: [EMAIL PROTECTED]
Rights: "Copyright (C) Brian Hawley 2000, rights under GPL"
Purpose: "Make it easy to run a REBOL script as a DOS batch file."
Usage: trim/auto {
#!REBOL.BAT helps you to express a REBOL script as a DOS batch
file. The first argument is the name of the calling batch file
(expressed best as {%0} to handle spaces, etc.). A REBOL batch
file that uses #!REBOL.BAT looks something like this:

@echo off
#!REBOL {%0} -q %1 %2 %3 %4 %5 %6 %7 %8 %9

REBOL [
Title: "Hello World"
]
print "Hello World!"
print system/script/args

if confirm "Do you want to quit? (Y or N) " [quit]
}
Comments: trim/auto {
In order to work, you must name this file #!REBOL.BAT so that
it will be treated as a batch file. The .BAT is essential, but
the #! is only there as part of the #!language script calling
convention from Unix, useful on other OS's too. #!REBOL can
now handle batch files that aren't on the path or whose name
can change by passing {%0} as the batch name. You must put
#!REBOL.BAT somewhere on the OS path and change the call to
REBOL.exe above to reflect the location of the files REBOL.exe
and #!REBOL.BAT.
This script incorporates the function to-rebol-file which is
seperately licensed under the LGPL.
}
Category: [file script]
]

if unset? 'to-rebol-file [
; The wierd bit with init here is to work around a GC bug :(
use [init] [
init: make object! [
alpha: charset [#"A" - #"Z" #"a" - #"z"]
dos-char: complement charset [
#"^(0)" - #"^(1f)" {\/:*?|"}
]
amiga-char: complement charset ":/"
]

to-rebol-file: func [
"Changes a valid platform filename into a rebol file."
file-name [string!] "A platform-format filename."
/default "Return this file instead of none when not valid."
default-file [file!]
/dir "Add a trailing /, if needed, to indicate a directory."
/platform "Follow the filename conventions of a given platform."
which [integer!] "A REBOL major platform number"
/local
DOS Amiga MacOS Unix alpha file-char rebol-file tmp
] head insert bind/copy [
; Initialize the transformation rules
DOS: [
rebol-file: make file! length? file-name
if not parse/all file-name [
[ ; Prefix, if any
; Drive letter
copy tmp alpha ":" [
"\" (
insert insert insert
tail rebol-file #"/" tmp #"/"
) | none (
if (to-char tmp)  (second what-dir) [
insert insert insert
tail rebol-file #"/" tmp #"/"
]
)
] |
; UNC path (no single-letter computer names!)
"\\" (insert tail rebol-file #"/") |
; Root dir of current drive
"\" (insert tail rebol-file "//") |
none
] [ ; File path, if any
copy tmp some dos-char (insert tail rebol-file tmp)
any ["\" copy tmp some dos-char (
insert insert tail rebol-file #"/" tmp
) ]
["\" (insert tail rebol-file #"/") | none] |
none
]
] [ ; Parse failed
rebol-file: none
  

[REBOL] Running from batch file? Re:(4)

2000-02-15 Thread brian . hawley

Whoops!

The copy of #!REBOL.BAT I included had 2 bugs and one
slower part, all fixed in the version I've included
with this message. My bad!

At 09:32 AM 2/15/00 -0600, I wrote:
REBOL starts in the REBOL home directory, not the current
directory. If your script is in a different directory, you
have to specify the whole path to the script on the command
line to REBOL.

Apparently this is different with /View. #!REBOL.BAT still
works with /View, but I should take /View into account when
it is released.

Brian Hawley


@ECHO OFF
shift
rem *** The folowing call must be on ONE line ***
C:\Lang\Rebol\REBOL.exe --do "application-dirs: parse/all {%PATH%} {;}" --script 
C:\Utilities\bin\#!REBOL.BAT %0 %1 %2 %3 %4 %5 %6 %7 %8 %9
goto end-of-REBOL-launcher

REBOL [
Title: "#!REBOL Script Launcher"
Date: 15-Feb-2000
File: %#!REBOL.BAT
Author: "Brian Hawley"
Email: [EMAIL PROTECTED]
Rights: "Copyright (C) Brian Hawley 2000, rights under GPL"
Purpose: "Make it easy to run a REBOL script as a DOS batch file."
Usage: trim/auto {
#!REBOL.BAT helps you to express a REBOL script as a DOS batch
file. The first argument is the name of the calling batch file
(expressed best as {%0} to handle spaces, etc.). A REBOL batch
file that uses #!REBOL.BAT looks something like this:

@echo off
#!REBOL {%0} -q %1 %2 %3 %4 %5 %6 %7 %8 %9

REBOL [
Title: "Hello World"
]
print "Hello World!"
print system/script/args

if confirm "Do you want to quit? (Y or N) " [quit]
}
Comments: trim/auto {
In order to work, you must name this file #!REBOL.BAT so that
it will be treated as a batch file. The .BAT is essential, but
the #! is only there as part of the #!language script calling
convention from Unix, useful on other OS's too. #!REBOL can
now handle batch files that aren't on the path or whose name
can change by passing {%0} as the batch name. You must put
#!REBOL.BAT somewhere on the OS path and change the call to
REBOL.exe above to reflect the location of the files REBOL.exe
and #!REBOL.BAT.
This script incorporates the function to-rebol-file which is
seperately licensed under the LGPL.
}
Category: [file script]
]

if not value? 'to-rebol-file [
; The wierd bit with init here is to work around a GC bug :(
use [init] [
init: make object! [
alpha: charset [#"A" - #"Z" #"a" - #"z"]
dos-char: complement charset [
#"^(0)" - #"^(1f)" {\/:*?|"}
]
amiga-char: complement charset ":/"
]

to-rebol-file: func [
"Changes a valid platform filename into a rebol file."
file-name [string!] "A platform-format filename."
/default "Return this file instead of none when not valid."
default-file [file!]
/dir "Add a trailing /, if needed, to indicate a directory."
/platform "Follow the filename conventions of a given platform."
which [integer!] "A REBOL major platform number"
/local
DOS Amiga MacOS Unix rebol-file tmp
] head insert bind/copy [
; Initialize the transformation rules
DOS: [
rebol-file: make file! length? file-name
if not parse/all file-name [
[ ; Prefix, if any
; Drive letter
copy tmp alpha ":\" (
insert insert insert rebol-file #"/" tmp #"/"
) | copy tmp alpha ":" (
if (to-char tmp)  (second what-dir) [
insert insert insert rebol-file #"/" tmp #"/"
]
) |
; UNC path (no single-letter computer names!)
"\\" (insert rebol-file #"/") |
; Root dir of current drive
"\" (insert rebol-file "//") |
none
] [ ; File path, if any
copy tmp some dos-char (insert tail rebol-file tmp)
any ["\" copy tmp some dos-char (
insert insert tail rebol-file #"/" tmp
) ]
["\" (insert tail rebol-file #"/") | none] |
none
]
] [ ; Parse failed
rebol-file: none
]
]
Amiga: [
rebol-file: make file! length? file-name
if not parse/all file-name [
; Device
[copy tmp 0 30 amiga-char ":" (
insert insert insert rebol-file #"/" any [tmp ""] #"/"
) | none]
; Directory path
copy tmp any "/" (
if tmp [insert/dup rebol-file "../" length? tmp]
)
any [ 
copy tmp 1 30 amiga-char "/" (
insert insert tail rebol-file tmp #"/"
)
copy tmp any "/" (
if tmp [
insert/dup tail rebol-file "../" length? tmp
]
   

[REBOL] Running from batch file? Re:

2000-02-14 Thread Al . Bri

B Paddock wrote:
 If I do "Rebol dns.r" from the DOS prompt (DOS box of Windoze 95) my dns.r
program runs fine.

 If I put the same thing in a batch file, then Rebol just brings up the
console, and dns.r is not loaded, just goes right to the Rebol prompt.

 How do you start rebol  program from batch file?

I've tried REBOL/View with a batch file and it works fine. Here's what's
inside the batch file:

"C:\Program Files\REBOL\View\REBOL.EXE" %ChorusLine.r

I've also run from inside a C program, using the "system" function with the
above command line.

Andrew Martin
Ooh laa laa!
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--




[REBOL] Running from batch file? Re:(2)

2000-02-14 Thread bpaddock

 How do you start rebol  program from batch file?

I've tried REBOL/View with a batch file and it works fine. Here's what's
inside the batch file:

"C:\Program Files\REBOL\View\REBOL.EXE" %ChorusLine.r

I'm trying to do with with Core 2.2.0.3.1.

I've tried these variations, while being in the same
directory as rebol.exe:

rebol dns.r
rebol %dns.r
"rebol.exe" %dns.r
"rebol.exe" dns.r"

while being in a different directory:

"C:\REBOL\Rebol.exe" %dsn.r
"C:\REBOL\Rebol.exe" dsn.r

they all just go to the "" prompt.

Can type them manually and they work fine.

BTW, is the "%" required on the command line?  Seems to work
with or with-out it.



[REBOL] Running from batch file? Re:

2000-02-14 Thread tim781

Hey, Have you tried to add a dos command to your bat file
to change the current directory before the command
to run your script.. It prob'ly seems not worth trying
but dos is different like that. win95 won't recognize my
cd-rom drive but if I first start dos and then windows
my cd-rom drive shows up in windows explorer.

timmy


[EMAIL PROTECTED] wrote:

 If I do "Rebol dns.r" from the DOS prompt (DOS box of
 Windoze 95) my dns.r program runs fine.

 If I put the same thing in a batch file, then Rebol just
 brings up the console, and dns.r is not loaded, just goes
 right to the Rebol prompt.

 How do you start rebol  program from batch file?





[REBOL] Running from batch file? Re:(3)

2000-02-14 Thread terry . chilvers

 Looks like a dos path issue
 
 If I run a batch file from my rebol directory
 rebol test.r
 
 it works fine
 
 from another directory I run
 c:\rebol\rebol test.r
 
 and I just get the command prompt
 
 if I run
 cd c:\rebol
 rebol test.r
 
 it again works
 
 terry


__ Reply Separator _
Subject: [REBOL] Running from batch file? Re:(2) 
Author:  [EMAIL PROTECTED] at internet
Date:14/02/2000 21:02


 How do you start rebol  program from batch file?

I've tried REBOL/View with a batch file and it works fine. Here's what's
inside the batch file:

"C:\Program Files\REBOL\View\REBOL.EXE" %ChorusLine.r

I'm trying to do with with Core 2.2.0.3.1.

I've tried these variations, while being in the same
directory as rebol.exe:

rebol dns.r
rebol %dns.r
"rebol.exe" %dns.r
"rebol.exe" dns.r"

while being in a different directory:

"C:\REBOL\Rebol.exe" %dsn.r
"C:\REBOL\Rebol.exe" dsn.r

they all just go to the "" prompt.

Can type them manually and they work fine.

BTW, is the "%" required on the command line?  Seems to work
with or with-out it.





[REBOL] Running from batch file? Re:(3)

2000-02-14 Thread Al . Bri

Here's a batch file that works for REBOL 2.2.0.3.1:

"C:\Program Files\REBOL\REBOL.EXE" "c:\Program
Files\REBOL\View\ChorusLine.r"

REBOL 2.2 needs a full path to the script. It's different in REBOL/View.

Andrew Martin
ICQ: 26227169
http://members.xoom.com/AndrewMartin/
--

Another round of applause for the REBOL City Music Hall REBOLettes!

REBOL 2.2.0.3.1
Copyright (C) 1998-1999 REBOL Technologies
REBOL is a Trademark of REBOL Technologies
All rights reserved.

Finger protocol loaded
Whois protocol loaded
Daytime protocol loaded
SMTP protocol loaded
POP protocol loaded
HTTP protocol loaded
FTP protocol loaded
NNTP protocol loaded
Script: "REBOL Extended Definitions" (3-Sep-1999/17:55:08)
Script: "User Preferences" (26-Jan-2000)
Script: "Patch" (26-Jan-2000)
Script: "Include" (25-Jan-2000)
Script: "Script" (19-Dec-1999)
Script: "ReSwitch" (10-Dec-1999)
Script: "Cls" (23-Jan-2000)
Script: "Desktop" (30-Dec-1999)
Script: "Printer" (24-Jan-2000)
Script: "Ifs" (16-Jan-2000)
Script: "Dir" (24-Jan-2000)
Script: "Stack" (21-Jan-1999)
Script: "The REBOL City REBOLettes" ("13-Jan-2000")


  Presenting the REBOL City Music Hall REBOLettes!


.@@@..@@@..@@@..@@@..@@@.
@o_o@@o_o@@o_o@@o_o@@o_o@
/\v/\/\v/\/\v/\/\v/\/\v/\
\(_)/\(_)/\(_)/\(_)/\(_)/
 | |  | |  | |  | |  | |
_| |__| |__| |__| |__| |_


  **applause**applause***

Next Show 10 p.m.





[REBOL] Running from batch file? Re:

2000-02-14 Thread Petr . Krenzelok



[EMAIL PROTECTED] wrote:

 If I do "Rebol dns.r" from the DOS prompt (DOS box of
 Windoze 95) my dns.r program runs fine.

 If I put the same thing in a batch file, then Rebol just
 brings up the console, and dns.r is not loaded, just goes
 right to the Rebol prompt.

 How do you start rebol  program from batch file?

kurzy.bat
--
start /w rebol -sq kurzy-seznam.r
import /PATH=G:\aplikace\promiss\system

We even managed another app to wait untill the rebol part of the task is
not finished by using start /w

I tried to run REBOL from Netware login script. It runs, but on some
machines we get black Rebol console screen. Once you begin to type,
background changes back to default console b/w coloring. Problems with
refresh when started from dos prompt? Don't know.

-pekr-