Using call with view/pro
[1/12] from: philb:upnaway at: 13-Mar-2002 9:47
Hi,
On Win98 when I run a native command using 'call is it possible to stop the MS DOS box
being flashed up.
I have tried all the refinements redirecting input, output & error to none ...
but to no avail.
eg call/input/output/error "copy c:\panel.r c:\panel2.r" none none none
Cheers Phil
[2/12] from: greggirwin:mindspring at: 12-Mar-2002 22:50
Hi Phil,
<< On Win98 when I run a native command using 'call is it possible to stop
the MS DOS box being flashed up. >>
Someone had this issue a while back, and calling the API directly solved it,
if you're not concerned about portability. Here's an excerpt from an object
I use with various API stuff in it:
win-lib: load/library %shell32.dll
execute: make routine! [
hwndParent [integer!]
Operation [string!]
File [string!]
Parameters [string!]
Directory [string!]
ShowCmd [integer!]
return: [integer!]
] win-lib "ShellExecuteA"
; Operation values
; "open"
; "print"
; "explore"
; ShowCmd values
; 0 Hides the window and passes activation to another window.
;
; 1 Activates and displays a window. If the window is minimized
; or maximized, Windows restores it to its original size and
; position (same as 9).
;
; 2 Activates a window and displays it as an icon.
;
; 3 Activates a window and displays it as a maximized window.
;
; 4 Displays a window in its most recent size and position. The
; window that is currently active remains active.
;
; 5 Activates a window and displays it in its current size and
; position.
;
; 6 Minimizes the specified window and activates the top-level
; window in the system's list.
;
; 7 Displays a window as an icon. The window that is currently
; active remains active.
;
; 8 Displays a window in its current state. The window that is
; currently active remains active.
;
; 9 Activates and displays a window. If the window is minimized
; or maximized, Windows restores it to its original size and
; position (same as 1).
execute 0 "open" "notepad.exe" "" "" 1
execute 0 "open" "calc.exe" "" "" 1
HTH!
--Gregg
[3/12] from: philb:upnaway at: 13-Mar-2002 15:11
Hi Gregg,
Excellent, I will give it a go ....
Cheers Phil
=== Original Message ===
Hi Phil,
<< On Win98 when I run a native command using 'call is it possible to stop
the MS DOS box being flashed up. >>
Someone had this issue a while back, and calling the API directly solved it,
if you're not concerned about portability. Here's an excerpt from an object
I use with various API stuff in it:
win-lib: load/library %shell32.dll
execute: make routine! [
hwndParent [integer!]
Operation [string!]
File [string!]
Parameters [string!]
Directory [string!]
ShowCmd [integer!]
return: [integer!]
] win-lib "ShellExecuteA"
; Operation values
; "open"
; "print"
; "explore"
; ShowCmd values
; 0 Hides the window and passes activation to another window.
;
; 1 Activates and displays a window. If the window is minimized
; or maximized, Windows restores it to its original size and
; position (same as 9).
;
; 2 Activates a window and displays it as an icon.
;
; 3 Activates a window and displays it as a maximized window.
;
; 4 Displays a window in its most recent size and position. The
; window that is currently active remains active.
;
; 5 Activates a window and displays it in its current size and
; position.
;
; 6 Minimizes the specified window and activates the top-level
; window in the system's list.
;
; 7 Displays a window as an icon. The window that is currently
; active remains active.
;
; 8 Displays a window in its current state. The window that is
; currently active remains active.
;
; 9 Activates and displays a window. If the window is minimized
; or maximized, Windows restores it to its original size and
; position (same as 1).
execute 0 "open" "notepad.exe" "" "" 1
execute 0 "open" "calc.exe" "" "" 1
HTH!
--Gregg
[4/12] from: philb:upnaway at: 13-Mar-2002 17:18
Hi Gregg,
Running executables/batch files works OK.
However I particularly wanted to copy a file from 1 location to another on Win98 without
having to read the file in in Rebol and writting it back out again.
This would preserve the date/time stamp.
I am unsure as to what I should pass into file .... or is there a different API
for this?
Cheers Phil
(I have successfully made a batch file that receieves parameters that does the job).
=== Original Message ===
Hi Phil,
<< On Win98 when I run a native command using 'call is it possible to stop
the MS DOS box being flashed up. >>
Someone had this issue a while back, and calling the API directly solved it,
if you're not concerned about portability. Here's an excerpt from an object
I use with various API stuff in it:
win-lib: load/library %shell32.dll
execute: make routine! [
hwndParent [integer!]
Operation [string!]
File [string!]
Parameters [string!]
Directory [string!]
ShowCmd [integer!]
return: [integer!]
] win-lib "ShellExecuteA"
; Operation values
; "open"
; "print"
; "explore"
; ShowCmd values
; 0 Hides the window and passes activation to another window.
;
; 1 Activates and displays a window. If the window is minimized
; or maximized, Windows restores it to its original size and
; position (same as 9).
;
; 2 Activates a window and displays it as an icon.
;
; 3 Activates a window and displays it as a maximized window.
;
; 4 Displays a window in its most recent size and position. The
; window that is currently active remains active.
;
; 5 Activates a window and displays it in its current size and
; position.
;
; 6 Minimizes the specified window and activates the top-level
; window in the system's list.
;
; 7 Displays a window as an icon. The window that is currently
; active remains active.
;
; 8 Displays a window in its current state. The window that is
; currently active remains active.
;
; 9 Activates and displays a window. If the window is minimized
; or maximized, Windows restores it to its original size and
; position (same as 1).
execute 0 "open" "notepad.exe" "" "" 1
execute 0 "open" "calc.exe" "" "" 1
HTH!
--Gregg
[5/12] from: g:santilli:tiscalinet:it at: 13-Mar-2002 11:44
Hi Gregg,
On Wednesday, March 13, 2002, 6:50:02 AM, you wrote:
GI> ; Operation values
GI> ; "open"
GI> ; "print"
GI> ; "explore"
Gregg, could this be used to open/print PDF files too? (I'll try
it anyway ASAP...)
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[6/12] from: tbrownell:shaw:ca at: 13-Mar-2002 2:31
Copying creates new file info, moving retains the old.
;To copy a file...
kern32: load/library %kernel32.dll
CopyIt: make routine! [
lpExistingFileName [string!]
lpNewFileName [string!]
bFailIfExists [integer!]
return: [integer!]
] kern32 "CopyFileA"
;CopyIt "C:/original.r" "C:/trash/copy.r" 0
;To move a file...
MoveIt: make routine! [
lpExistingFileName [string!]
lpNewFileName [string!]
] kern32 "MoveFileA"
;MoveIt "C:/file.r" "D:/file.r"
TBrownell
----- Original Message -----
From: <[philb--upnaway--com]>
To: <[rebol-list--rebol--com]>
Sent: Wednesday, March 13, 2002 1:18 AM
Subject: [REBOL] Re: Using call with view/pro
> Hi Gregg,
>
> Running executables/batch files works OK.
>
> However I particularly wanted to copy a file from 1 location to another on
Win98 without having to read the file in in Rebol and writting it back out
again.
[7/12] from: greggirwin:mindspring at: 13-Mar-2002 10:55
Hi Gabriele,
<< could this be used to open/print PDF files too? (I'll try
it anyway ASAP...) >>
You know, when I posted that last night, the same thought hit me! If the
association is set up correctly, it should. Let me know if it works on your
end, and I'll try it here as well.
--Gregg
[8/12] from: greggirwin:mindspring at: 13-Mar-2002 10:57
Hi Phil,
<< However I particularly wanted to copy a file from 1 location to another
on Win98 without having to read the file in in Rebol and writting it back
out again.
This would preserve the date/time stamp. >>
Terry beat me to it. Thanks Terry! I haven't tried those APIs myself, from
REBOL, but they should work just fine.
--Gregg
[9/12] from: philb:upnaway at: 14-Mar-2002 16:17
Hi Terry/Gregg,
thanks for the help .... this works fine
Cheers Phil
=== Original Message ===
Copying creates new file info, moving retains the old.
;To copy a file...
kern32: load/library %kernel32.dll
CopyIt: make routine! [
lpExistingFileName [string!]
lpNewFileName [string!]
bFailIfExists [integer!]
return: [integer!]
] kern32 "CopyFileA"
;CopyIt "C:/original.r" "C:/trash/copy.r" 0
;To move a file...
MoveIt: make routine! [
lpExistingFileName [string!]
lpNewFileName [string!]
] kern32 "MoveFileA"
;MoveIt "C:/file.r" "D:/file.r"
TBrownell
----- Original Message -----
From: <[philb--upnaway--com]>
To: <[rebol-list--rebol--com]>
Sent: Wednesday, March 13, 2002 1:18 AM
Subject: [REBOL] Re: Using call with view/pro
> Hi Gregg,
>
> Running executables/batch files works OK.
>
> However I particularly wanted to copy a file from 1 location to another on
Win98 without having to read the file in in Rebol and writting it back out
again.
[10/12] from: g:santilli:tiscalinet:it at: 15-Mar-2002 15:31
Hi Gregg,
On Wednesday, March 13, 2002, 6:55:01 PM, you wrote:
GI> You know, when I posted that last night, the same thought hit me! If the
GI> association is set up correctly, it should. Let me know if it works on your
GI> end, and I'll try it here as well.
It works, but there seems to be no difference between "open" and
print
. But maybe that's related to Acrobat settings...
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r
[11/12] from: greggirwin:mindspring at: 15-Mar-2002 13:32
Hi Gabriele,
<< It works, but there seems to be no difference between "open" and
print
. But maybe that's related to Acrobat settings... >>
I only tried it quickly here, but didn't have any success. Now I need to
find time to investigate a little more.
--Gregg
[12/12] from: g:santilli:tiscalinet:it at: 16-Mar-2002 12:50
Hi Gregg,
On Friday, March 15, 2002, 9:32:51 PM, you wrote:
[Opening PDF files]
GI> I only tried it quickly here, but didn't have any success. Now I need to
GI> find time to investigate a little more.
I used:
--
win-lib: load/library %shell32.dll
execute: make routine! [
hwndParent [integer!]
Operation [string!]
File [string!]
Parameters [string!]
Directory [string!]
ShowCmd [integer!]
return: [integer!]
] win-lib "ShellExecuteA"
win-open-file:
func [file [file!]]
[ execute 0 "open" to-string to-local-file clean-path file "" "" 1]
win-print-file:
func [file [file!]]
[ execute 0 "print" to-string to-local-file clean-path file "" "" 1]
--
but I see no difference between win-open-file and win-print-file
on PDF files.
Regards,
Gabriele.
--
Gabriele Santilli <[g--santilli--tiscalinet--it]> -- REBOL Programmer
Amigan -- AGI L'Aquila -- REB: http://web.tiscali.it/rebol/index.r