r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

Pekr
15-Aug-2009
[16727x5]
>> call "cmd dir"
== none

>> Microsoft Windows [Verze 6.0.6001]

Copyright (c) 2006 Microsoft Corporation. Všechna práva vyhrazena.

c:\!rebol\altme\worlds\r3-gui\files\rebdev>
boots me in the cmd shell imo ...
but in that shell, dir returns script error message about dir having 
no value ...
ah, consecutive call works, interesting ...
>> call "cmd dir"
== none

>> Microsoft Windows [Verze 6.0.6001]

Copyright (c) 2006 Microsoft Corporation. Všechna práva vyhrazena.

c:\!rebol\altme\worlds\r3-gui\files\rebdev>dir
** Script error: dir has no value


>> dir
 Svazek v jednotce C nemá žádnou jmenovku.
 Sériové číslo svazku je 0054-60D0.

 Výpis adresáře c:\!rebol\altme\worlds\r3-gui\files\rebdev

13.08.2009  12:12    <DIR>          .
13.08.2009  12:12    <DIR>          ..
02.07.2009  15:38    <DIR>          base
Anton
15-Aug-2009
[16732x2]
Hmm.. weird, looks like one line is taken by cmd, the next is taken 
by rebol.
(I mean the other order..)
Pekr
15-Aug-2009
[16734]
so:

1) call "cmd dir" boots me into cmd shell - notice single >
2) calling dir there boots me back to ... where? Notice >>
3) then mysteriously dir works from there ...
Anton
15-Aug-2009
[16735]
Ok, I would avoid calling cmd directly in rebol. I just wanted to 
know if anything could be successfully called.
Pekr
15-Aug-2009
[16736]
if that would be e.g. path problem, then for e.g. calling icacls 
would not work, but it works ... any other cmd commands to try?
Anton
15-Aug-2009
[16737x2]
I have forgotten how to get the path in windows console, is it
	echo %PATH
?
and to get and set the current directory. CD ?
Gabriele
15-Aug-2009
[16739]
Anton: my comment may be dismissive, but the point I'm making is 
that that is just my opinion, I'm not sure why I should be forced 
to "like" a heredoc syntax :) I understand that it is very handy 
on occasions, but the price is a ugly script, which I'd rather not 
pay if I can avoid it easily enough (for example, if I were generating 
a lot of PHP or JS, I would just build a dialect to do that, instead 
of using strings). Again, though it's funny for me to have to repeat 
it again and again, this is just IMHO, Robert should be free to do 
things his own way, and if REBOL can provide a syntax for heredocs 
without creating other problems I'm fine - I'll just avoid it (and 
I'll hope not many people start using it ;)
Pekr
15-Aug-2009
[16740x2]
Anton - just simple "path" does it ...
Some commands work, some don't call "path" does not work, call "help" 
works, etc.
Anton
15-Aug-2009
[16742]
Gabriele, I had a look at a few of the heredoc formats and some of 
them do look quite ugly. I admit that I actually haven't used heredocs 
myself yet, only come across a few snippets here and there recently, 
so I guess I don't have much experience with them yet, and can't 
tell what problems they may cause. My initial thought was that they 
would be a good idea, since you could just paste foreign code straight 
into your script.
Graham
15-Aug-2009
[16743]
Or you could use an editor which hides all the ugliness
BrianH
15-Aug-2009
[16744x2]
Pekr, commands like dir and path are built into cmd.exe - they aren't 
separate programs. So CALL "cmd.exe /c dir" should work.
At a command prompt, call cmd /? to get help on cmd.exe and its commands.
Pekr
15-Aug-2009
[16746x2]
Brian - "help" does it too ...
Brian - what's the mess with intermixing cmd shell, and rebol one? 
See above output. And why do I need to hit enter to get back to rebol 
console?
BrianH
15-Aug-2009
[16748x3]
R2 intermixed the cmd shell with CALL - with R3 you do that manually 
if you need to.
As for your other question, look at this:

>> call "cmd.exe /c dir"
== none

>>  Volume in drive E is APPS
 Volume Serial Number is 7845-7730

 Directory of E:\REBOL\2.100

01/14/2009  03:17 PM    <DIR>          .
01/14/2009  03:17 PM    <DIR>          ..
01/14/2009  03:24 PM    <DIR>          base
01/15/2009  12:17 PM    <DIR>          updates
07/12/2009  03:08 PM                56 blah.txt
02/25/2009  08:09 PM               492 user.r
03/02/2009  10:22 PM    <DIR>          work
04/09/2009  08:41 PM                66 test.r
06/13/2009  12:09 AM                28 mod1.r
06/13/2009  12:09 AM                28 mod2.r
06/13/2009  12:10 AM                47 mod.r
08/10/2009  08:39 PM    <DIR>          plugin
08/13/2009  03:35 PM           613,376 r3.exe
08/13/2009  07:08 PM    <DIR>          extension
08/13/2009  08:46 PM            20,480 ext-test.dll
               8 File(s)        634,573 bytes
               7 Dir(s)   4,893,769,728 bytes free
1 + 1
== 2


I did that 1 + 1 to show that I didn't have to hit enter to get back 
to REBOL. You only have to hit enter to see the prompt. The extra 
>> above the dir outpt is the result prompt that you aren't seeing 
below. This is because CALL on Windows returns immediately, rather 
than waiting for the called process to finish its work, including 
its console output.
Keep in mind that this behavior may change in the future: CALL is 
in the host code.
Pekr
15-Aug-2009
[16751]
how do I trap the console output into the variable for e.g.? something 
like str: call "cmd /c dir" does not make it ...
Henrik
15-Aug-2009
[16752]
call/output "cmd /c dir" my-var

I think
Pekr
15-Aug-2009
[16753]
there is no refinement with R3 call :-)
Henrik
15-Aug-2009
[16754]
well, I guess in R3 you don't do that. :-) Forget my response.
Pekr
15-Aug-2009
[16755]
the only chance, probably, is to catch console port?
Henrik
15-Aug-2009
[16756]
does 'echo work?
Pekr
15-Aug-2009
[16757x2]
Call is pretty unusable with R3. I have to say, that some ppl could 
already move to R3, but we have few showstoppers:

- call - really bad situation ....
- missing networking protocol 
- missing CGI mode

- DB access ... now we can proceed with extensions for SQLite, but 
not sure. If call would work at least, we could at least call sqlite.exe 
;-)


Unless those issues are fixed, R3 will be in alpha stage, and my 
opinion is - absolutly unnecessarily ...
echo? who want to work with file? Theat is weird. I want call being 
fixed, or it is good for nothing ...
Henrik
15-Aug-2009
[16759]
I thought you wanted debug output. Otherwise wait until CALL is fixed.
Paul
15-Aug-2009
[16760x3]
Pekr, what are yhou trying to do?
Sounds like Pekr is trying to capture the output of a directory listing 
in R3, is that correct?
anyway Pekr, just use:

call "cmd dir > somefile.txt"

then you can just read the file back into a string.
Pekr
15-Aug-2009
[16763x2]
Paul - correct ....
Paul - I know that is an option ... but what is it good then to get 
'call output into console, if it can't be even easily captured into 
a string?
Paul
15-Aug-2009
[16765]
Isn't that a limitation of R3?
Pekr
15-Aug-2009
[16766]
dunno. As an interim solution, you suggestion is good enough .... 
I'll wait for 'call being fixed/enhanced ...
Paul
15-Aug-2009
[16767]
Yeah, we will have to wait and see if they develop 'call further.
BrianH
15-Aug-2009
[16768]
CALL is in the host code. We'll fix it when the host code is released.
Nicolas
16-Aug-2009
[16769]
Can anyone tell me how to view an image with r3?
Steeve
16-Aug-2009
[16770]
Is it me, or the example to read a dns address is broken ???
>> print read dns://www.rebol.net
Nicolas
16-Aug-2009
[16771x2]
I get
make port! [
    spec: make object! [
        title: "DNS Lookup"
        scheme: 'dns
        ref: dns://www.rebol.net
        path: none
        host: "www.rebol.net"
        port-id: 80
    ]
    scheme: make object! [
        name: 'dns
        title: "DNS Lookup"
        spec: make object! [
            title: none
            scheme: none
            ref: none
            path: none
            host: none
            port-id: 80
        ]
        info: none
        actor: make native! [[]]
        awake: make function! [[event][print event/type true]]
    ]
    actor: make native! [[]]
    awake: make function! [[event][print event/type true]]
    state: #{}
    data: none
    locals: none
]
Steeve
16-Aug-2009
[16773]
Geez...

>> first wait read dns://www.rebol.net
read
== 216.240.11.203

>> first wait read dns://216.240.11.203
read
== "www.rebol.net"

A little bit obfuscated, but it works...
Henrik
16-Aug-2009
[16774]
Nicolas, VIEW in its built in state doesn't work properly, so do 
something like this:

>> load-gui
>> a: load http://arkandis.com/images/blog/google.gif
>> b: make gob! [image: a]
>> view b
Nicolas
16-Aug-2009
[16775]
thanks Henrik
Henrik
16-Aug-2009
[16776]
(This will be much easier in the future, I hope)