Page 1 of 1

Output window text delay

Posted: Fri Jun 06, 2014 8:16 am
by Double Reddog
I'm on the current release of primalscript. I've noticed ever since a few releases ago, that scripts which send text to the output window is delayed when displaying. This delay does not happen when running scripts from the CMD prompt, only from within primalscript. It also does not happen when running very simple scripts like:

for I = 1 to 10000
wscript.echo "Value of I: " & I
next

I think the issue is a result of another issue I had (see "output buffer limitation" from May 2nd). I did not experience this issue prior to that fix.

The output is always correct but displays in "chunks" as if it is buffered instead of being sent to the output screen in "real time". Would like to see this fixed if possible.

Re: Output window text delay

Posted: Fri Jun 06, 2014 11:15 am
by Alexander Riedel
I will look into it. The buffer delay should not be more than a second and hardly be noticeable. But if you can give me an example for a script where you see it I can see what can be done.

Re: Output window text delay

Posted: Fri Jun 06, 2014 12:40 pm
by Double Reddog
Here's a relatively simple example. The following script will generate a list of domain controllers in active directory. When I run it using cscript via a CMD prompt, the list of DC's will display one by one (about 3 per second) and the results will eventually make the screen scroll. This takes about 30 seconds to complete.

When I run the script in primalscript, I do not get the real time, one by one display of data. Rather, I get the entire screen of results at once and the script ends. It's as if the data is being buffered. The script also runs about 30 seconds. The results are the same.

On Error Resume Next

Set adoCommand = CreateObject("ADODB.Command")
Set adoConnection = CreateObject("ADODB.Connection")
adoConnection.Provider = "ADsDSOObject"
adoConnection.Open "Active Directory Provider"
adoCommand.ActiveConnection = adoConnection

Set objRootDSE = GetObject("LDAP://RootDSE")
strBase = "<LDAP://" & objRootDSE.Get("configurationnamingcontext") & ">"
strFilter = "(objectClass=nTDSDSA)"
strAttributes = "ADsPath"

strQuery = strBase & ";" & strFilter & ";" & strAttributes & ";subtree"
adoCommand.CommandText = strQuery
adoCommand.Properties("Page Size") = 100
adoCommand.Properties("Timeout") = 30
adoCommand.Properties("Cache Results") = False

Set adoRecordset = adoCommand.Execute

Do Until adoRecordset.EOF
Set objDC = GetObject(GetObject(adoRecordset.Fields("ADsPath")).Parent)
WScript.Echo objDC.cn
adoRecordset.MoveNext
Loop

Re: Output window text delay

Posted: Fri Jun 06, 2014 1:33 pm
by Alexander Riedel
What exact build are you running?

Re: Output window text delay

Posted: Fri Jun 06, 2014 1:37 pm
by Double Reddog
7.0.36

Re: Output window text delay

Posted: Fri Jun 06, 2014 1:37 pm
by Alexander Riedel
Also, I don't have any Active Directory setup here. Do you have an example that can be run on a standard Windows machine?

Re: Output window text delay

Posted: Fri Jun 06, 2014 1:44 pm
by Alexander Riedel
Never mind, I think I see what you mean.

Re: Output window text delay

Posted: Fri Jun 06, 2014 2:16 pm
by Double Reddog
I created an example which does not use AD. I can post it if you would like but it's a little lengthy. The script will read a folder on a given computer and simply list the files in that folder.

On a computer I created a folder call test; created a file named file1.txt and then copied this file 100 times.

When run via the CMD prompt, the files are displayed one by one - scrolling the screen as needed until all files are displayed.

When run via primalscript, the files are display in two "chunks". After a few seconds 1 "chunk" of about 66 files are displayed, followed by a brief pause (i.e. buffering), then the remaining 34 files are displayed.