Can a script run another script?
[1/8] from: reboler::programmer::net at: 14-Dec-2001 23:31
Can I run a script from a REBOL/View face?
So far I can launch the new script, but the old face/script closes.
I would like to pick a new script from a directory listing and run it, while keeping
the old one open.
Can REBOL/View do this? Or do I need View/Pro or Command?
[2/8] from: greggirwin:mindspring at: 14-Dec-2001 10:46
Hi Alan,
<< Can I run a script from a REBOL/View face?
So far I can launch the new script, but the old face/script closes.
I would like to pick a new script from a directory listing and run it, while
keeping the old one open.
Can REBOL/View do this? Or do I need View/Pro or Command? >>
You can use 'do, to run another script from within your script.
do %feedback.r
You can use 'launch to start a new interpreter process
launch "feedback.r"
- or-
launch %feedback.r
To launch a program other than REBOL, you need to use 'call in /View-Pro or
/Command.
HTH!
--Gregg
[3/8] from: greggirwin:mindspring at: 14-Dec-2001 11:00
Hi Alan
I should add that the /New refinement, used with View (i.e. View/New) is
another thing you may want to look at from the sounds of things.
--Gregg
[4/8] from: office:thousand-hills at: 15-Dec-2001 8:33
You can embed the script inside your %user.r setup file as a global
variable with a line like this
script_name: [ script ]
And then simply call the script as a function/variable like this
script_name
this is the way it is designed to work, if you need an example -I can offer
some.
John
At 10:46 AM 12/14/2001 -0700, you wrote:
[5/8] from: reboler:programmer at: 17-Dec-2001 22:17
Thanks Gregg, for pointing out the 'launch command. I hadn't noticed it before. It
works great in simples scripts like ...
view layout [button [launch %feedback.r]]
But I have a larger script whose relevant contents boils down to this ...
output: make object! [
file: %feedback.r
]
view layout [
button "Do Script!" [
if script? output/file [
launch output/file
]
]
]
The above works as a script unto itself, but within the larger script, I get the following
error message...
Launch can only be used by launcher programs
in a REBOL/View Dialog Box.
Since 'launch is undocumented, do you know what this error means?
[6/8] from: al:bri:xtra at: 18-Dec-2001 9:15
Alan wrote:
> The above works as a script unto itself, but within the larger script, I
get the following error message...
> "Launch can only be used by launcher programs" in a REBOL/View Dialog Box.
>
> Since 'launch is undocumented, do you know what this error means?
'Launch is designed to launch programs only from the first script. It's a
security measure. It's best to restructure your script.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
[7/8] from: rpgwriter:y:ahoo at: 17-Dec-2001 13:20
--- Andrew Martin <[Al--Bri--xtra--co--nz]> wrote:
> Alan wrote:
> > The above works as a script unto itself, but
<<quoted lines omitted: 8>>
> 'Launch is designed to launch programs only from the
> first script.
Is "the first script" the first one run by the REBOL?
Does that include, for instance, the /View desktop?
Chris Dicely
[8/8] from: al:bri:xtra at: 18-Dec-2001 12:38
> Is "the first script" the first one run by the REBOL?
It doesn't include the ones in Rebol. Just your scripts.
> Does that include, for instance, the /View desktop?
It shouldn't include the desktop in View.
Andrew Martin
ICQ: 26227169 http://valley.150m.com/
Notes
- Quoted lines have been omitted from some messages.
View the message alone to see the lines that have been omitted