Output window text delay

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST SUBSCRIPTION NUMBERS, LICENSE KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
User avatar
Double Reddog
Posts: 14
Joined: Sun Mar 03, 2013 12:39 pm

Output window text delay

Post by Double Reddog » Fri Jun 06, 2014 8:16 am

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.

User avatar
Alexander Riedel
Posts: 7121
Joined: Tue May 29, 2007 4:43 pm

Re: Output window text delay

Post by Alexander Riedel » Fri Jun 06, 2014 11:15 am

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.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Double Reddog
Posts: 14
Joined: Sun Mar 03, 2013 12:39 pm

Re: Output window text delay

Post by Double Reddog » Fri Jun 06, 2014 12:40 pm

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

User avatar
Alexander Riedel
Posts: 7121
Joined: Tue May 29, 2007 4:43 pm

Re: Output window text delay

Post by Alexander Riedel » Fri Jun 06, 2014 1:33 pm

What exact build are you running?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Double Reddog
Posts: 14
Joined: Sun Mar 03, 2013 12:39 pm

Re: Output window text delay

Post by Double Reddog » Fri Jun 06, 2014 1:37 pm

7.0.36

User avatar
Alexander Riedel
Posts: 7121
Joined: Tue May 29, 2007 4:43 pm

Re: Output window text delay

Post by Alexander Riedel » Fri Jun 06, 2014 1:37 pm

Also, I don't have any Active Directory setup here. Do you have an example that can be run on a standard Windows machine?
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Alexander Riedel
Posts: 7121
Joined: Tue May 29, 2007 4:43 pm

Re: Output window text delay

Post by Alexander Riedel » Fri Jun 06, 2014 1:44 pm

Never mind, I think I see what you mean.
Alexander Riedel
SAPIEN Technologies, Inc.

User avatar
Double Reddog
Posts: 14
Joined: Sun Mar 03, 2013 12:39 pm

Re: Output window text delay

Post by Double Reddog » Fri Jun 06, 2014 2:16 pm

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.