Os-command

JvdB

Member
Hi Peggers,

Windows 98SE
PROGRESS 8.3B

Im using OS-COMMAND to run a dos command.
This results in the MS-Command window being opened in Windows. In this command window a "dos editor" is open and it expects CTRL-D to continue.
How can i from my Progress code send the CTRL-D to the MS-Command window?

Any sample code would be greatly appreciated.
Thanx already,

J.
 

Crittar

Member
Hi,

I don't use DOS (I'm under UNIX) but does the same thing happen if you specify SILENT and / or NO-WAIT on the
OS-COMMAND?
 

JvdB

Member
I tried that at first, but then the result is that it doesn't finish it correct. Or simply that the action is cancelled.

Some more info:

The command I run starts the creation of an archive file for PVCS (dos version still). I already tried some commandline parameters for that but it simply wants a CTRL-D or Z to finish correctly.

I'm not sure if a batch file would solve the problem.

For example if i would make a bat file with the command to start the creation of the archive file on one line and on the next is tell it to do a CTRL-D

I have no clue if the CTRL-D would fire then after the first command...or if it would wait till i manually do ctrl-d and then do it from the bat-file.

I also have no clue how to generate CTRL-D from within a batfile though.
 
You can also try to put you OS-COMMAND in a batch file and launch this batch.

EXAMPLE:

DEF VAR c_rep_pkzip AS CHAR INITIAL "c:\winnt\".
DEF VAR c_rep_in AS CHAR INITIAL "c:\temp".

Instead of
--------------

OS-COMMAND (C_rep_PkZip + "pkunzip.exe " + C_rep_in + "\file.zip -o " + C_rep_in + " ").

Try :
------

OUTPUT TO VALUE("unzip.bat") NO-ECHO CONVERT TARGET "iso8859-1".
MESSAGE C_rep_PkZip + "pkunzip.exe " + C_rep_in + "\file.zip -o " + C_rep_in + " ".
OUTPUT CLOSE.

OS-COMMAND SILENT VALUE ("unzip.bat").


It oftens give better results.
 

JvdB

Member
Finally internet access again so sorry for belated replies.


Using a batch command would not solve my problem right now.
At least I think, cause I still wouldn't have a clue to generate keyboard input after that, since the option to close the program it opens can't be given as a commandline parameter.



The CreateProcess might be an option though i'm inexperienced in that area.

How would I go about starting for example edit.exe (dos editor)
and then after it started send ALT+F to it followed by X to shut it down for example?
So what I want is a way to perhaps fake Keyboard input in the opened dos-window.
Any sample code would be greatly appreciated.

Will try and figure out the CreateProcess some more.
 

bendaluz2

Member
What exactly are you trying to achieve?

It seems a bit odd to open up an editor and then close it down straight away.
 

JvdB

Member
that's not the point, it was ment as an example since most windows versions got the dos editor still.
And if it's possible to send an alt+f to the dos editor then it should also be possible to send a ctrl+d to the dos program I open in my code.

I "simply" want to be able to send or simulate a ctrl+d in the dos window that was opened. Or simulate any other keyboard input to an opened window. Is it even possible?
 

bendaluz2

Member
I think it is possible, certainly using windows API calls, but I remember in the good old DOS days playing round with keystroke recorders that you could use to do this.

What i meant by 'what are you trying to do' was more along the lines of what are you trying to with the editor, as in could you do it with some ocx or interface to a windows component that might make it easier to control.
 

JvdB

Member
Do you mean a general ocx, or an ocx of the program i try to control? Cause the version we currently use is fully dos. We might upgrade one day to a windows version, but no idea when they'll push that through ;)
 

bendaluz2

Member
no, sorry, I mean, what function is it that you are using the editor to achieve? presumably you are manipulating a text file in some way. Could this manipulation be done by another program other than the dos editor. for example could something like word do it, which you could control via ole, thus giving you a lot more control over what you are doing.

Hope this is clearer :)
 

JvdB

Member
I see, ok I think I understand what you mean now, heh sorry for that ;)

Hmmm, ok how to say. The command I execute starts a program and this creates a sort of log file for a version control system.
In this file I assume some data is logged according to some settings. This is all done bij the version control software. Which is all dos right now. But to finish creating this logfile the program wants either some text input followed by Ctrl+D or Ctrl+Z.

Normally we not enter any text so we give CTRL+D and it creates the logfile in the correct format and place on the network.
Now when only doin one or two files this isn't really a problem, but when more...well then it would simply be easier when it's automatic.

Maybe it's possible to do it with windows word or something, but that would mean I'd have to find out what is written and where, since right now the dos program takes care of all that.
This also wouldn't be worth the effort probably since in future the whole version control software might be upgraded to a windows version, with a lot more automated possibilities.

So for now the "Quickest" way would be to just send a ctrl+d to the dos-window. Though I must admit I'm out of my league here as a junior programmer.....then again...If not ask questions, would probably never learn new tricks ;)
 

bendaluz2

Member
Ah, i see what you mean, by "dos editor" I thought you meant the old edit.exe, but you mean a prompt of some kind. I think the only way you are going to do this is to get a keystroke recorder.

then, you want to record the following sequence (assuming your version control software is vcs.exe )
<code>
vcs.exe &ltenter&gt
ctrl-d
</code>
then create a batch file which executes the sequence, probably something like
<code>
keystroke.exe &ltsequence-file&gt
</code>
then simply run this batch file with your os-command
 
Top