Wow! I haven't seen that one in a long time! I created that tool several
years ago.
I'm glad it works for you David.
Shannon O'Donnell
-----Original Message-----
From: midrange-l-bounces+sodonnell=turbogorilla-software.com@xxxxxxxxxxxx
[mailto:midrange-l-bounces+sodonnell=turbogorilla-software.com@xxxxxxxxxxxx]
On Behalf Of David FOXWELL
Sent: Tuesday, December 04, 2007 11:23 AM
To: Midrange Systems Technical Discussion
Subject: RE: RUNRMTCMD STRPCCMD
So how do I open a document on the IFS with Word on my PC with RUNRMTCMD?
I'm now trying out Shannon's CommandServerJDQ like this : EXPCCMD2
CMDSTG('\\Myi5\home\foxwell\word.bat')
Word.bat :
"C:\Program Files\Microsoft Office\Office\WINWORD.EXE" "\\
Myi5\home\foxwell\thisdoc1.DOC"
AND it WORKS! Needs some adjustements to make Word always open in front of
the green screen and a trick to make the green screen wait. Also, no ugly
DOS window !
Thanks for all the help.
-----Message d'origine-----
De : midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] De la part de Shannon ODonnell
Envoyé : lundi 3 décembre 2007 23:09
À : 'Midrange Systems Technical Discussion'
Objet : RE: RUNRMTCMD STRPCCMD
Start does not actually work in a "wait" mode on all, or even most, Windows
executables. But if you only need it for Word then you're probably safe.
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of John Brandt
Sent: Monday, December 03, 2007 3:14 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: RUNRMTCMD STRPCCMD
Or you could do your command using:
"Start windword.exe \\thepathtomydoc\document.doc /wait"
It will not close until word has been closed, just like a batch file.
John Brandt
iStudio400.com
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Shannon ODonnell
Sent: Monday, December 03, 2007 2:38 PM
To: 'Midrange Systems Technical Discussion'
Subject: RE: RUNRMTCMD STRPCCMD
Just to expand on Scott's answer a little bit...
If you want to wait for a process to complete when calling it from the
iSeries, then RUNRMTCMD ain't going to cut it for almost all situations.
Instead, you have to do some Windows programming and you have to use the
following Windows APIs:
CreateProcessByNum
WaitForSingleObject
WaitforInputIdle
There are a couple of others you need too, depending on what process you are
actually running and what kind of information it returns to the API, but
those are the primary ones.
Using them are not for the faint of hearted.
HTH
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx
[mailto:midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: Monday, December 03, 2007 1:15 PM
To: Midrange Systems Technical Discussion
Subject: Re: RUNRMTCMD STRPCCMD
Hi David,
The batch file works because Microsoft designed batch files to wait for
programs to end before running the next program.
On a technical level, Windows software uses the CreateProcess() API to
launch a new program. It returns a process handle, and you can then choose
to wait for this process to end by calling the
WaitForSingleObject() API to wait for the process handle to end. That's
great if you're running a Windows program, but it won't run MS-DOS programs.
To run a DOS program, you have to start up the DOS environment by calling
cmd.exe or by using a different API (aside from CreateProcess()). I suspect
that IBM's incoming remote command server runs everything through a DOS API
so that you can specify either a DOS command or a Windows program, and it
runs it.
The problem there is that the DOS interface does NOT give you a chance to
wait for a Windows program to end. It waits for DOS commands fine, but
Windows commands just start in the background.
You can see what I mean by opening up a DOS command and running a windows
program. e.g. c:\windows\notepad.exe -- you'll notice that immediately
after you type the commadn you get a new command prompt...
that's because the command prompt doesn't wait for windows programs (like
Notepad or Word) to end... it starts them then proceeds to the next thing.
If you want to wait for them to end, you need to write Windows code that
uses CreateProcess() and WaitForSingleObject().
However, when Microsoft wrote support for Batch files, they took it a step
further. They detected whether the command you're running was a Windows
program or not, and if it was, they wait for it to end.
(Basically, by calling CreateProcess(), et al, under the covers). Since a
Batch file *is* an MS-DOS program, you can run Word via a batch file, and
it'll wait for it.
Sorry if that was too long-winded. It's also a lot of guessing... I'm not a
Windows expert.
Anyway...
Why do you need a password to access network resources? Because, Windows
needs to send a userid/password to the network server (in this case, the
iSeries NetServer running on your System i).
Basically, when you run a command via RUNRMTCMD you're starting a 2nd
session on the Windows PC (much in the way that you might have two
sessions on i5/OS simply by opening two 5250 windows). That second
session is kept separate from the interactive one where the user is logged
on to the desktop. So, even though the user has already signed in to
Windows with a userid/password, your RUNRMTCMD needs it's own
userid/password in order to access the network, since it needs to know what
userid/password to connect to network servers with.
David FOXWELL wrote:
Thanks Scott, I'm beginning to get there.
I notice that I can open Word with 'Start Winword.exe' but the command
doesn't wait for Word to be ended. I put the command in a .bat and
that way the i5 waits for Word to end. What's happening here exactly?
Now, I want to open a Word document that's common to all users and
therefore stored in the IFS. I can only do it if I type my username
and password on the RUNRMTCMD. I don't need a password, however, to
open a document that's on my PC.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
No virus found in this incoming message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.9/1155 - Release Date: 11/27/2007
8:30 PM
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.503 / Virus Database: 269.16.9/1155 - Release Date: 11/27/2007
8:30 PM
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx To subscribe, unsubscribe,
or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx Before posting, please take a
moment to review the archives at
http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.