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.
Output window text delay
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
DO NOT POST LICENSE NUMBERS, ACTIVATION 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.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: Output window text delay
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.
SAPIEN Technologies, Inc.
- Double Reddog
- Posts: 14
- Last visit: Mon Oct 16, 2017 8:17 am
Re: Output window text delay
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
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
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: Output window text delay
What exact build are you running?
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Double Reddog
- Posts: 14
- Last visit: Mon Oct 16, 2017 8:17 am
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: Output window text delay
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.
SAPIEN Technologies, Inc.
- Alexander Riedel
- Posts: 8488
- Last visit: Tue Apr 16, 2024 8:42 am
- Been upvoted: 37 times
Re: Output window text delay
Never mind, I think I see what you mean.
Alexander Riedel
SAPIEN Technologies, Inc.
SAPIEN Technologies, Inc.
- Double Reddog
- Posts: 14
- Last visit: Mon Oct 16, 2017 8:17 am
Re: Output window text delay
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.
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.