DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I write to console?

Does someone know how to write to stdout within a VBScript in DIAdem?

 

The following is not supported in DIAdem (also see http://zone.ni.com/reference/en-XX/help/370858M-01/scripting/methods/scripting_method_getstandardstr...😞
Dim fso, oTextStream
fso = CreateObject("Scripting.FileSystemObject")
oTextStream = fso.GetStandardStream(1, FALSE)
oTextStream.WriteLine("This is a test.")
oTextStream.Close

 

Something like WScript (http://ss64.com/vb/stdoutwrite.html) is also not working.

 

I need to write the status of DIAdem processing to stdout to make it accessible via commandl line (continuous integration server).

0 Kudos
Message 1 of 5
(7,136 Views)

A solution I have seen:

 

 

Option Explicit

call WriteLineShared("C:\temp\out.txt", "Hello from DIAdem")

sub WriteLineShared(byref filePath, byref content)
  dim fh : fh = TextFileOpen(filePath, eTextFileAttributeWrite or eTextFileAttributeDenyNone or eTextFileAttributeANSI)
  call TextfileWriteLn(fh, content)
  call TextFileClose(fh)
end sub

Use the TextFileOpen method to open a file in shared mode. Allow reading from other processes while file is written.

Afterwards you can use a command like Tail.exe from unix tools to trace the output to the command line.

tail.exe -f "C:\temp\out.txt"

 

0 Kudos
Message 2 of 5
(7,126 Views)

Hi,

 

I'm using also this one:

Call MsgLineDisp("Start of the script")
Call LogfileDel()
Call LogfileWrite(Str(CurrDateTimeReal, "#YYYY-mm-DD HH:NN:SS ampm"))
Call LogfileWrite("Start of the script")
Call LogfileBrowser()

First one is display in the left bottom corner of the DIAdem current status of script execution and LogfileWrite writes into the LOG file whatever you want. Then you can call for this LOG (open it) using LogfileBrowser or save it somewhere to have further access.

Message 3 of 5
(7,119 Views)

Ok, so there's no solution to directly write to console in DIAdem.

Thanks for the work-arounds nevertheless!

0 Kudos
Message 4 of 5
(7,070 Views)

In additional there is

dbm "Hello"

which writes an Debug String to debug out.

But like most Windows applications std::out can not be captured by cmd.

Just console applications can do this directly.

0 Kudos
Message 5 of 5
(7,063 Views)