Sign in to follow this  
Followers 0
IvanCodin

Progress bar while command completes

5 posts in this topic

I am trying to get a progress bar to show while a command is running. I have put the query in multiple places but it doesn't seem to find the right combination. Because I am not do a run command is the a way to show progess until the command completes? Here is the script:

#include <AD.au3>

_AD_Open()
Global $aProperties[1][2]

MsgBox(0,"Info", "AD Information for user " & @UserName & " will be found" & @CRLF &  "The query may take several minutes to complete",3)

ProgressOn("Progress Meter", "Waiting for query to return data", "0 percent")

For $i = 10 to 100 step 10
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
MsgBox(0,"TS", "Pre Query",3)
$aProperties = _AD_GetObjectProperties(@UserName)
MsgBox(0,"TS", "Post Query",3)
sleep(500)
ProgressOff()
MsgBox(0,"TS", "Array is built",3)
_ArrayDisplay($aProperties, "AD Functions - Properties for '" & @UserName & "'")
MsgBox(0,"TS", "Array is displayed",3)
_AD_Close()

Share this post


Link to post
Share on other sites



I ran your code sans the _adopen() function and the progress bar launched and worked properly

If your progress bar isn't launching with that code snippet, disable the _adopen() and see if it launches, report back.

I am trying to get a progress bar to show while a command is running. I have put the query in multiple places but it doesn't seem to find the right combination. Because I am not do a run command is the a way to show progess until the command completes? Here is the script:

#include <AD.au3>

_AD_Open()
Global $aProperties[1][2]

MsgBox(0,"Info", "AD Information for user " & @UserName & " will be found" & @CRLF &  "The query may take several minutes to complete",3)

ProgressOn("Progress Meter", "Waiting for query to return data", "0 percent")

For $i = 10 to 100 step 10
    sleep(1000)
    ProgressSet( $i, $i & " percent")
Next
MsgBox(0,"TS", "Pre Query",3)
$aProperties = _AD_GetObjectProperties(@UserName)
MsgBox(0,"TS", "Post Query",3)
sleep(500)
ProgressOff()
MsgBox(0,"TS", "Array is built",3)
_ArrayDisplay($aProperties, "AD Functions - Properties for '" & @UserName & "'")
MsgBox(0,"TS", "Array is displayed",3)
_AD_Close()

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

When I comment out the _AD_Open I do not get the result of the query as expected. The query works without any issues. My problem is this:

The progress displayed in the current script is really acting as a delay. I am trying to get the progress bar to run while the _AD_getObjectProperties query is competing. I don 't really care about the percentage complete being dispalyed because the script will never compelete within a know timeframe. A scrolling progess bar is actually preferred. The network, size of ad and pc will all effect the time necessary to run the command. runwait looks like it can do this for a dos command but I don't see a way to do this for the query run in this script.

Edited by IvanCodin

Share this post


Link to post
Share on other sites

I'm guessing that your delay (and the reason you need the progress window) is occurring in the _AD_Open() function.

The for statement will never be executed until the _AD_Open() function and the lines underneath of it are executed first.

You may have to put a do/while or do/until loop in your _AD_Open() function at the point the actual hang occurs at

When I comment out the _AD_Open I do not get the result of the query as expected. The query works without any issues. My problem is this:

The progress displayed in the current script is really acting as a delay. I am trying to get the progress bar to run while the _AD_getObjectProperties query is competing. I don 't really care about the percentage complete being dispalyed because the script will never compelete within a know timeframe. A scrolling progess bar is actually preferred. The network, size of ad and pc will all effect the time necessary to run the command. runwait looks like it can do this for a dos command but I don't see a way to do this for the query run in this script.

Share this post


Link to post
Share on other sites

Maybe something like this, if I understood you correctly:

#include <AD.au3>

_AD_Open()
Global $aProperties[1][2]

MsgBox(0,"Info", "AD Information for user " & @UserName & " will be found" & @CRLF & "The query may take several minutes to complete",3)

ProgressOn("Progress Meter", "Waiting for query to return data", "0 percent")
MsgBox(0,"TS", "Pre Query",3)
AdlibRegister("Progress", 1000)
$aProperties = _AD_GetObjectProperties(@UserName)
MsgBox(0,"TS", "Post Query",3)
sleep(500)
AdlibUnRegister("Progress")
ProgressOff()
MsgBox(0,"TS", "Array is built",3)
_ArrayDisplay($aProperties, "AD Functions - Properties for '" & @UserName & "'")
MsgBox(0,"TS", "Array is displayed",3)
_AD_Close()

Func Progress()
    $i += 10
    ProgressSet( $i, $i & " percent")
EndFunc

Live and Learn, 'cause Knowledge is Super Power.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0