11.0, windows 7
I've known that this works for quite some time (10.1 at least, I think, or possibly even since XP came on the scene) but does anyone know how to supress the black window that pops up (and shows nothing) ?
here's some sample code to show what I mean: note the black window that pops up and disappers *before* the first message box
def var Line1 as char no-undo.
input through value("dir && set") . /** run dir and set in the same process */
repeat:
import unformatted Line1.
message Line1 view-as alert-box.
end.
input close.
Just curious Julian, did you find a solution for this?
unfortunately, not yet.
How about dropping the ABL stream completly and use a
System.Diagnostic.Process (http://msdn.microsoft.com/en-us/library/system.diagnostics.process.aspx)
to run your external command (which may execute asynchronously or not if you prefer) and acquire the StdOut Steam reference from the .NET Process object? You can read the stream in the ProcessCompleted event, if you demand synchronous execution, then use the WaitForExit() method of the Process object.
Check our blog for the samples of last year's "Extreme Windows Desktop Integration" presentation and don't miss this year's PUG Challenge Americas presentation for the sequel... (you may have to ask Tom that we're not overlapping this time)
Basically you create a ProcessStartInfo structure, assion FileName, Arguments, WorkingDirectory, RedirectStandardOutput = TRUE, UseShellExecute = FALSE, Start() the Process Object, WaitForExit() on the Process Object and then oProcess:StandardOutput:ReadToEnd().
I hope your "dir" command was just an example, because using System.IO.Directory:GetFiles () is a much better option here too.
I am writing a set of classes to use the JIRA api , and wanted the source to be platform-agnostic. I didn't want to have to use sockets, and a quick win was to be able to use curl from a command line. Using input-through meant that I didn't have to write different code for windows and *nix.
But, hey. Such is life.
I will probably write a class using system.process for windows, and input-through for *nix. That's not such a bad thing
Thanks for the info.
Oh, yes, we'll have to make sure that Tom knows which side his bread is buttered on
I will probably write a class using system.process for windows, and input-through for *nix. That's not such a bad thing
That's what we're doing. Even we have to work without .NET once in a while On *nix AppServers or Windows AppServers on 10.2B.
KB P6660
seems to indicate there is no ABL fix...
Status: Verified
SYMPTOM(s):
Using the INPUT THROUGH statement causes a DOS-box to appear.
The following code shows the problem:
DEF VAR z AS CHAR.
INPUT THROUGH VALUE("DIR").
SET z.
INPUT CLOSE.
FACT(s) (Environment):
Windows 32 Intel
Windows NT 32 Intel/Windows 2000
Progress 8.x
Progress 9.x
OpenEdge 10.x
CAUSE:
Bug# 19960610-011
CAUSE:
This issue is a result of MS Windows behavior. For every new process,
the MS Windows OS creates a new window.
FIX:
The way to suppress the created unwanted window from appearing on
screen is by using MS Windows settings to change the console window
default position to outside of the desktop. There is no way from
Progress to make this window not to appear.
These could be alternate ways:
a) first a os-commad into a temp-file and then to read temp-file.
os-command value(dir && set > temp.txt) silent.
input from temp.txt.
b) What happens if the needed are done with START command, where you can tell to minimize the window.
START ["title"] [/D polku] [/I] [/MIN] [/MAX] [/SEPARATE | /SHARED]
[/LOW | /NORMAL | /HIGH | /REALTIME | /ABOVENORMAL | /BELOWNORMAL]
[/NODE ] [/AFFINITY ] [/WAIT] [/B]
[komento/ohjelma] [parametrit]
The curiosity with START is that you has always put the "title" berfore starting the actual programs or commands.
Like: start "" c:\dlc\11\bin\prowin32.exe /MIN
c) Also there is a possibility use a vbs (or jscript). I think they can be started silently (cscript /c ..) without a window.
But learning vbs can be ... interesting.
Windos Scripting Host is installed on windows machines (since windows 98).
An exmple of a script to list Start Menu Folder: http://gallery.technet.microsoft.com/scriptcenter/0b3c068c-c765-4880-bc68-effb2d0e543e
But sorry, I did not have time to test these ideas.
KB P6660
seems to indicate there is no ABL fix...
Status: Verified
SYMPTOM(s):
Using the INPUT THROUGH statement causes a DOS-box to appear.
Bug# 19960610-011
CAUSE:
This issue is a result of MS Windows behavior. For every new process,
the MS Windows OS creates a new window.
FIX:
The way to suppress the created unwanted window from appearing on
screen is by using MS Windows settings to change the console window
default position to outside of the desktop. There is no way from
Progress to make this window not to appear.
Hello,
is everybody believing this (no way)?
As Mike proposed and i use since many years with XP, System.Diagnostics.Process run a process without opening a window.
That's my running code with input and output redirection (sorry it's only VB.NET with german comments)
Dim Anwendung As System.Diagnostics.Process = New System.Diagnostics.Process
' Die StartInfo-Struktur des Process-
' Objekts mit Informationen befllen
With Anwendung.StartInfo
.FileName = FaxExe
.CreateNoWindow =
True ' Kein Konsolenfenster erzeugen
' StandardInput, -Output und -Error umleiten:
.RedirectStandardInput =
True
.RedirectStandardOutput =
True
.RedirectStandardError =
True
.UseShellExecute =
False ' Pflicht bei Umleitungen
End With
' Den Befehlszeileninterpreter starten:
Anwendung.Start()
' StreamReader- und Writer-Objekte fr den
' Zugriff auf StdIn, StdOut und StdErr erzeugen
' ber ein StreamWriter-Objekt in StandardInput schreiben
Dim StdIn As System.IO.StreamWriter = Anwendung.StandardInput
StdIn.AutoFlush =
True ' Puffer automatisch flushen
' ber ein StreamReader-Objekt aus StandardOutput lesen
Dim StdOut As System.IO.StreamReader = Anwendung.StandardOutput
' ber ein StreamReader-Objekt aus StandardError lesen
Dim StdErr As System.IO.StreamReader = Anwendung.StandardError
StdIn.WriteLine(
"tifffile c:\hibis-dr\work\report.tif")
StdIn.WriteLine(
"comment " & Fax_Info & " (G)") ' G um den grafischen zu erkennen
...
' Konsolenausgabe auslesen:
Dim sOutput As String ' Konsolen-Ausgaben
Dim sError As String ' Konsolen-Fehler
StdIn.Close()
sOutput = StdOut.ReadToEnd
sError = StdErr.ReadToEnd
' Streams schliessen
StdOut.Close()
StdErr.Close()
' Umwandlung der ASCII-Zeichen in Ansi-Codepage (Nr. 850):
sOutput = System.Text.Encoding.GetEncoding(850).GetString(System.Text.Encoding.Default.GetBytes(sOutput))
' Kommando ggf. "abschiessen":
If Not Anwendung.HasExited Then
Anwendung.Kill()
End If
' Ressourcen des Process-Objekts freigeben
Anwendung.Close()
Sor
I didn't checked this with Win7 until today but assume that it will work.
have you tried NO-ECHO ??
input through .... no-echo.
the NO-ECHO removes the display of the results of the input through.
and much simpler than sending/retrieving from a file.