call/output to string bug in Windows
[1/5] from: tbrownell:l3technology at: 26-Feb-2003 5:20
Hi,
Any work being done on the call/output to string bug for /view on XP?
The following crashes everytime, but only if launched as a file. It won't
crash if lines are input directly to rebol console>??
(Example uses Wordnet Shell call)
rebol []
a: copy {}
view layout [
btn [call/output "wn bug" a print a]
This strikes me as a rather major bug given that it shuts down the shell
function (more or less)for certain windows users.
[2/5] from: g:santilli:tiscalinet:it at: 27-Feb-2003 9:49
Hi Terry,
On Wednesday, February 26, 2003, 2:20:56 PM, you wrote:
TB> rebol []
TB> a: copy {}
TB> view layout [
TB> btn [call/output "wn bug" a print a]
A workaround is to add a PRINT before the CALL, i.e.
a: copy {}
print "Workaround for CALL bug"
view layout [btn [call/output "wn bug" a print a]]
I understand that having the console open is probably not a viable
workaround for most applications; I think the only workaround in
such case is to output to a file and then read it.
TB> This strikes me as a rather major bug given that it shuts down the shell
TB> function (more or less)for certain windows users.
It actually does for ALL windows users AFAIK. The bug has been
reported and I hope to see it fixed soon too. (It would be nice to
be able to avoid the MSDOS window popping too. :)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[3/5] from: tbrownell:l3technology at: 27-Feb-2003 9:56
Aye, that Dos window is a pain. There may be a way to do shell calls using
the Windows ShellExecute API, but from what I see, it can only be used to
launch applications, open a browser to a URL (this must be what "Browse"
uses.) Find a copy of the API below...
But how to use this to do a shell command, WITH output to a string! ??
;-----------------
rebol []
a: %/c/windows/system32/shell32.dll
b: load/library a
c: "ShellExecuteA"
r: make routine! [
hwnd [integer!]
lpOperation [string!]
lpFile [string!]
lParameters [string!]
lpDirectory [string!]
nShowCmd [integer!]
] b c
view layout [
btn "Rebol" [r 0 "open" "http://www.rebol.com" "" "" 1]
btn "Word Doc" [r 0 "open" "c:\whatever.doc" "" "" 1]
btn "More Info" [browse http://www.vb-helper.com/howto_shellexecute.html]]
;Where lpFile is the program (or file ) you wish to launch.
;---------------
[4/5] from: g::santilli::tiscalinet::it at: 28-Feb-2003 9:47
Hi Terry,
On Thursday, February 27, 2003, 6:56:54 PM, you wrote:
TB> launch applications, open a browser to a URL (this must be what "Browse"
TB> uses.) Find a copy of the API below...
I use this as well.
TB> But how to use this to do a shell command, WITH output to a string! ??
I think there's no easy way; maybe on NT you could send the output
to a pipe and get it back on REBOL; in general you could send the
output to a temporary file and read it back. I don't know if this
is easy to do with ShellExecute, surely there has to be a way to
do it.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[5/5] from: greggirwin:mindspring at: 28-Feb-2003 12:51
Hi Gabriele,
TB>> But how to use this to do a shell command, WITH output to a string! ??
GS> I think there's no easy way; maybe on NT you could send the output
GS> to a pipe and get it back on REBOL; in general you could send the
GS> output to a temporary file and read it back. I don't know if this
GS> is easy to do with ShellExecute, surely there has to be a way to
GS> do it.
I don't know if there's an easy way as I haven't played with it, but
the harder way would be to use CreateProcess, CreatePipe, and
WaitFor[Single?]Object and do all the work of reading pipes yourself.
Should be possible, but maybe more than a few lines of code.
-- Gregg